Skip to content

fix(dashboard): ignore time grain filters on metric-only semantic charts - #46331

Closed
mikebridge wants to merge 2 commits into
apache:masterfrom
mikebridge:fix-semantic-time-grain-filter-scope
Closed

mikebridge wants to merge 2 commits into
apache:masterfrom
mikebridge:fix-semantic-time-grain-filter-scope

Conversation

@mikebridge

Copy link
Copy Markdown
Member

SUMMARY

TL;DR: Keep semantic-view Big Number charts rendering when a dashboard Time grain filter or display control selects a duration but the chart has no grouping columns.

Background: Dashboard time-grain settings can apply to several charts at once. Table and Interactive Table already omit a grain when their grouped columns are known not to be dates.

Problem: A metric-only semantic chart can receive a grain without a time dimension and fail with “A time column must be specified when a time grain is provided.”

What this changes: Apply the existing conservative rule in the shared semantic query builder. Charts with no grouping columns ignore the irrelevant grain, while Table and Interactive Table retain their existing behavior for known non-date groupings. Metrics and time-range filters are preserved. Ordinary SQL datasets are unchanged.

Scope and limits

  • Active time dimensions retain their selected grain.
  • Other grouped chart types on a semantic view are not covered yet and still show the time-column error when given a grain without a time dimension.
  • Unknown or expression-based columns keep the grain for validation.
  • Stored query contexts, including single-chart reports and API reads of a saved chart, are unchanged until the chart is re-saved from the fixed frontend.

Technical details

  • Move omitDormantTimeGrain into core query utilities and keep the existing chart-controls export as a compatibility re-export.
  • Apply it to final semantic aggregate queries after chart-specific construction and axis normalization; retain the raw-query exclusion.
  • Remove the two table-specific calls. No provider, backend validation, persistence, or SQL-dataset behavior changes.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No browser check has been done on this PR, and no screenshot is available.

TESTING INSTRUCTIONS

Automated validation: 560 tests passed across 50 affected query-builder and dashboard suites. Changed-file hooks passed, including frontend TypeScript. Regression coverage exercises native filters and display controls on metric-only charts, active/unknown temporal selections, raw queries, and ordinary datasets. Removing the common normalization call reproduces the regression.

Manual verification (not yet run on this PR):

  1. With semantic layers enabled and a configured semantic view, add a Big Number chart containing a metric and no grouping columns to a dashboard.
  2. Apply a Time grain native filter, selecting Month. Confirm the chart continues rendering with the same aggregate and time-range constraint.
  3. Repeat using a Time grain display control.
  4. Check a semantic chart with an active time dimension: changing Day to Month must retain the selected grain.
  5. Check Table and Interactive Table with known non-date grouped columns, then an ordinary SQL-dataset chart. Their existing behavior should remain unchanged.
  6. Verify the documented limits separately: other grouped semantic chart types still report the time-column error, and a stored chart query context needs re-saving before replay uses the corrected request.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: existing SEMANTIC_LAYERS flag
  • Changes UI: prevents an error on the covered dashboard charts; no visual redesign
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions Bot added doc Namespace | Anything related to documentation plugins packages labels Nov 18, 2026
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.46%. Comparing base (05139fb) to head (69867d9).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #46331      +/-   ##
==========================================
+ Coverage   85.44%   85.46%   +0.01%     
==========================================
  Files        3101     3101              
  Lines      213763   213824      +61     
  Branches    50459    50491      +32     
==========================================
+ Hits       182660   182737      +77     
+ Misses      27677    27661      -16     
  Partials     3426     3426              
Flag Coverage Δ
javascript 81.96% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mikebridge

Copy link
Copy Markdown
Member Author

Closing in favour of #46339, which handles this in the backend: a time grain that cannot apply (a field that is not a date, or no date grouped at all) is now ignored for semantic views, as it already is for datasets. That covers the metric-only and table cases this PR addressed, and also grouped charts such as bar, line and pie, which this PR did not.

@mikebridge mikebridge closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation packages plugins size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant