Skip to content

Conversation

@msyavuz
Copy link
Member

@msyavuz msyavuz commented Nov 27, 2025

SUMMARY

  • superset/models/helpers.py: Fixed temporal column detection logic and removed problematic Strategy 4
  • tests/unit_tests/models/helpers_test.py: Added new comprehensive test for the fix
  • tests/unit_tests/common/test_query_context_processor.py: Updated existing tests to expect new behavior

TESTING INSTRUCTIONS

Tests should pass.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 27, 2025
@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 27, 2025
- Fix function name collision in test_query_context_processor.py
- Remove trailing whitespace in helpers_test.py
- Update test expectations to reflect removal of datasource column fallback
- Fix line length and formatting issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@msyavuz msyavuz marked this pull request as ready for review November 27, 2025 20:50
@dosubot dosubot bot added the change:backend Requires changing the backend label Nov 27, 2025
Comment on lines +1716 to +1717
elif isinstance(col, dict) and col.get("sqlExpression"):
return str(col.get("label") or col.get("sqlExpression"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would col be a dict? From my tests, if you use custom SQL to create the original time range filter, the chart won't allow you to add a time comparison config. You can use a calculated column, but looking at queries[0].filter I still see this in the payload:

{col: "${COLUMN_NAME}", op: "TEMPORAL_RANGE", val: "2005 : 2006"}

Is this scenario a precautionary measure, or something you were able to reproduce? I'm asking it because I noticed you're looking for label or sqlExpression, and I was wondering if we should look for name too (which I think it depends if this is for a particular calculated column flow I couldn't reproduce, or specifically for custom SQL in the filter).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, AdhocColumn type is a dict containing label and no name. That's why i am checking it here. If the payload doesn't match the type we should do the update there but i don't think that would be the case.

class AdhocColumn(TypedDict, total=False):
    hasCustomLabel: bool | None
    label: str
    sqlExpression: str
    isColumnReference: bool | None
    columnType: Literal["BASE_AXIS", "SERIES"] | None
    timeGrain: str | None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha!

Copy link
Contributor

@Vitor-Avila Vitor-Avila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@msyavuz msyavuz merged commit a754258 into master Dec 1, 2025
132 of 133 checks passed
@msyavuz msyavuz deleted the msyavuz/fix/temporal-column-timeshifts branch December 1, 2025 14:24
TheDanDan pushed a commit to Wengxin04/superset-cscd01project that referenced this pull request Dec 2, 2025
sadpandajoe pushed a commit that referenced this pull request Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants