Repository navigation
fix(semantic-layer): ignore inapplicable time grains - #46339
Merged
mikebridge merged 3 commits intoNov 19, 2026
Merged
Conversation
3 of 9 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #46339 +/- ##
=======================================
Coverage 85.50% 85.50%
=======================================
Files 3104 3104
Lines 214171 214183 +12
Branches 50585 50587 +2
=======================================
+ Hits 183126 183139 +13
+ Misses 27617 27616 -1
Partials 3428 3428
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
marked this pull request as ready for review
November 19, 2026 00:18
mikebridge
requested review from
aminghadersohi,
fitzee,
gabotorresruiz and
rebenitez1802
November 19, 2026 00:19
Contributor
2 of 6 tasks
aminghadersohi
approved these changes
Nov 19, 2026
aminghadersohi
left a comment
Contributor
There was a problem hiding this comment.
Inapplicable grains are dropped consistently in validation and mapping.
Nit: A query-level grain on a text field with grain variants is still refused, as on master; untested.
Nit: test_categorical_legacy_grain_refuses_time_bounds docstring overstates: grainless bounds still hit the text field.
This was referenced Nov 19, 2026
9 tasks
hainenber
pushed a commit
that referenced
this pull request
Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Fix semantic-view charts that fail when a time grain is attached to a text grouping. A new Bar chart grouped by a text field should work with the default Day grain, just as it does for a SQL dataset. Time range filters still apply.
Background
Chart builders attach a time grain (Day by default) to the x-axis of Bar, Line, Area, Scatter and Mixed charts, even when that axis is a text field. Dashboards can also add a query-level grain to charts that group by no date field.
Problem
SQL datasets ignore a grain that cannot apply to the grouping. Semantic views refused it, so a new chart grouped by a text field could fail before the user changed any time settings. Saved query contexts and direct API requests could encounter the same refusal.
What this changes
Semantic views ignore a grain on a known non-date field when that field has no advertised grain variants. They also ignore a query-level grain when no date is grouped. A field that advertises grain variants retains its grain, even if its default representation is text or numeric. Time range filters continue to use the raw date field; this change does not redirect them to another column.
SUMMARY
The mapper uses the existing Arrow date/time/timestamp classification and the full dimension metadata to distinguish an inapplicable grain from a requested, supported grouping. Validation and mapping use the same condition. The input query object is not rewritten, so stored contexts and original chart-data cache keys remain intact. SQL datasets are unchanged, and there is no cache format change.
Validation still refuses:
Known limits:
is_timeseriesrequests that ask for bucketing without a grouped time column remain unbucketed on semantic views, as before. An unsupported grain in that shape is no longer refused.columnTypeis notBASE_AXIS.Verification on this tree:
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No browser or live-warehouse check has been done on this PR, and no screenshot is available yet. The behavior described above is covered by local automated checks; manual validation remains outstanding.
TESTING INSTRUCTIONS
Automated regression checks:
pytest tests/unit_tests/semantic_layers/mapper_test.py -k 'dormant_grain or categorical_legacy'Manual checks still to run with a configured semantic view exposing a text grouping, a date dimension with raw/Day/Month variants, and a metric:
ADDITIONAL INFORMATION
Draft for review; no frontend code, schema migration, new flag or public API shape change.