Repository navigation
fix(semantic-layers): separate grain and offset time-axis resolvers - #42093
Conversation
Two `_get_time_axis_column` functions coexisted in `mapper.py`: an offset-oriented resolver (first temporal column, falling back to a `TEMPORAL_RANGE` adhoc filter so aggregate-only charts still get offset-aware bounds) and a grain-oriented resolver (only claims an axis when exactly one temporal column is selected). The second definition shadowed the first, so: - mypy failed pre-commit with `Name "_get_time_axis_column" already defined [no-redef]`, turning the branch red. - The offset call sites (`_get_time_filter`, `_get_group_limit_filters`) silently ran the grain resolver, dropping the time offset / time comparison bounds for aggregate-only charts whose temporal column lives only in a `TEMPORAL_RANGE` filter. The unit test covering that path was already failing but stayed hidden because an unrelated Python 3.10 CI leg errored out first and cancelled the sibling jobs. Rename the grain resolver to `_get_grain_time_axis_column` and point its call sites (`map_query_object`, `_validate_granularity`) at it, leaving the offset resolver under the original name for the offset call sites. Reconcile the two duplicated test blocks so both resolvers are covered. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Code Review Agent Run #f275e6Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42093 +/- ##
==========================================
+ Coverage 64.43% 65.09% +0.66%
==========================================
Files 2747 2747
Lines 153977 153977
Branches 35318 35318
==========================================
+ Hits 99216 100237 +1021
+ Misses 52849 51829 -1020
+ Partials 1912 1911 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mikebridge
left a comment
There was a problem hiding this comment.
fixes the naming conflict---lgtm
…pache#42093) Co-authored-by: Claude Opus 4.8 <[email protected]>
SUMMARY
superset/semantic_layers/mapper.pydefined_get_time_axis_columntwice, with deliberately different semantics:TEMPORAL_RANGEadhoc filter, so aggregate-only charts that carry the temporal column only in a filter still get offset-aware time bounds. Used by_get_time_filterand_get_group_limit_filters.Noneso the grain path falls back to raw variants instead of guessing. Used bymap_query_objectand_validate_granularity.Because both shared the name
_get_time_axis_column, the second definition shadowed the first. Two consequences:Name "_get_time_axis_column" already defined [no-redef]— turning the branch red.TEMPORAL_RANGEfilter. The unit test covering that path was already failing but stayed hidden because an unrelated Python 3.10 CI leg errored out first and cancelled the sibling jobs.This PR renames the grain resolver to
_get_grain_time_axis_columnand points its call sites (map_query_object,_validate_granularity) at it, leaving the offset resolver under the original name for its call sites. The two duplicated test blocks are reconciled so both resolvers are covered.TESTING INSTRUCTIONS
185 tests pass. Before this change,
test_get_time_axis_column_finds_temporal_in_temporal_range_filterfailed (the masked regression) andpre-commit run mypyreported the[no-redef]error; both pass now.ADDITIONAL INFORMATION