Skip to content

fix(sunburst): keep the saved time grain in Explore - #45571

Merged
aminghadersohi merged 18 commits into
apache:masterfrom
aminghadersohi:fix-sunburst-explore-temporal-grain
Oct 24, 2026
Merged

aminghadersohi merged 18 commits into
apache:masterfrom
aminghadersohi:fix-sunburst-explore-temporal-grain

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Explore rebuilds form data from the chart's controls. Retain the saved Sunburst Time Grain so opening a saved chart in Explore applies it to its temporal hierarchy levels.

Design. The Sunburst panel has a Time grain control, shown for physical temporal hierarchy levels, with no initial grain for new charts. The hidden lookup retains temporal metadata; there is no hidden Time Column control. The dataset lookup selects all physical temporal levels, and a legacy Time Column can additionally identify a hierarchy level without disabling other lookup-marked levels. Query columns become BASE_AXIS physical references with timeGrain; saved hierarchy columns remain names. Explore saves the lookup in params. The server-side query builder uses the same lookup-or-legacy-subject rule.

  • Hidden grain controls reset to null when the temporal hierarchy is removed. Dataset edits, dashboard Edit Chart, and chart-type carryover cannot persist a hidden Sunburst Time Column through Explore controls.
  • Drill to detail and Drill by use raw bucket equality plus grain, including engine-specific grains. The backend applies the dataset Hours offset before truncation and retains independent bucket predicates when their Time Column is unchanged. A Time Column override that replaces a different temporal column discards filters on that replaced column, restoring the existing fallback for Timeseries drill payloads.
  • Drill-filter labels display their ISO grain; editing the column, operator, value, or expression type clears the grain, while unchanged duplicates retain it.
  • Semantic views validate and group each explicitly grained level independently, and resolve grained drill filters to the provider's matching grain variant.
  • Embedded guest validation still accepts references to saved hierarchy columns and rejects references outside the hierarchy.
  • Charts without a grain remain raw. Adhoc hierarchy expressions are not grained. A legacy Time Column outside the hierarchy does not disable lookup-marked grains; an older chart with neither temporal metadata nor a Time Column needs an Explore re-save before a dashboard grain can identify its temporal levels.
  • The unrelated translation source-location line is removed. Sunburst guest tests live separately so the existing security test module is unchanged.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screenshots

Sunburst saved with Time Grain = Month, opened in Explore: the control shows Month and the order_date ring has one segment per month (180 rows)

Hierarchy of categorical columns only: the Time Grain control is hidden and no grain is sent

Explore, Time Grain changed to Year: the same ring regroups by year (21 rows)

Dashboard with a Time Grain native filter set to Month: the grained Sunbursts show months, including one saved without a grain

Same dashboard after changing the Time Grain filter to Year: both temporal rings regroup by year; the categorical chart is unchanged

Drill to detail on the October 2004 segment of a monthly ring: the filter identifies the month's bucket and the modal lists that month's 159 rows (same as a direct SQL count)

Drill by product line from the October segment on a dataset with a 5 hour offset: the filter identifies the bucket and the slices add up to the ring's 170 rows

Historical captures at 9d8c2acb; drill payloads at this head use equality plus grain rather than temporal ranges. Local docker-compose-light env at the PR head, examples dataset cleaned_sales_data (order_date 2003-01 to 2005-05) plus a virtual dataset over it with a 5 hour Hours offset.

Before: an MCP-created Sunburst with a monthly temporal level returns 3 rows through MCP but 90 daily rows when opened in Explore. After: Explore shows the Time grain control set to Month and queries the 3 monthly rows.

TESTING INSTRUCTIONS

  1. Create a Sunburst whose hierarchy has a temporal level with a monthly grain (via the MCP generate_chart tool, or in Explore by choosing Time grain = Month).
  2. Open it in Explore: the Time grain control shows Month and the temporal ring has one segment per month.
  3. Save it, add it to a dashboard with a Time Grain native filter, change the filter to Year: the ring regroups by year.
  4. With a hierarchy of only categorical columns, the Time grain control is hidden and no grain is sent.
  5. On a monthly segment, right-click > Drill to detail by : the modal lists the rows of that whole month.
  6. On the same segment, right-click > Drill by > another column: the drilled chart is filtered to that month's range. On a dataset with an Hours offset, both drills return exactly the rows the ring counted.

Automated:

  • npx jest src/explore/controlUtils/sunburstTimeGrain.test.ts plugins/plugin-chart-echarts/test/Sunburst
  • pytest tests/unit_tests/mcp_service/chart/test_sunburst_chart.py tests/unit_tests/security/manager_test.py tests/unit_tests/semantic_layers/mapper_test.py tests/unit_tests/common/test_form_data_query_context.py tests/unit_tests/models/test_sunburst_drill_hours_offset.py

Regression checks cover time-range/granularity rewrites through QueryContextFactory.create, exact per-category bucket membership with a dataset Hours offset, lookup-marked grains under legacy Time Column overrides, Explore dataset edits and dashboard/chart-type carryover, semantic multi-level grouping and drill variants, malformed temporal lookups, hidden-control resets, and typed form-data fields. Source reverts reproduce the failures; the raw-level assertion also rejects a TEMPORAL_RANGE mutation.

Scope and landing plan:

  • An MCP-saved chart without a temporal lookup can grain only its legacy Time Column; opening it in Explore can grain additional temporal hierarchy levels. Preserving a separate MCP-owned subject is not part of this change.
  • Drill by retains only the clicked level, not temporal or categorical ancestors, matching the existing Sunburst contract. Drill to detail retains the hierarchy path.
  • fix: filter Sunburst temporal segments by bucket and invert Hours offset in grained filters #45598 landed first. Merge 0463cee incorporates master and makes its cross-filter, drill and label code use the lookup-based Sunburst/timeGrain.ts helper. Bucket cross-filters and inverted Hours-offset behavior are retained.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in [SIP-59] Proposal for Database migration standards #13351)
    • 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

A Sunburst saved with a grain on a temporal hierarchy level kept the grain
only in granularity_sqla/time_grain_sqla. The Sunburst control panel has
neither control, so Explore dropped both and queried the level at its raw
(daily) values.

Give the Sunburst panel a Time grain control (shown when a hierarchy level
is temporal, no default grain for new charts) and the hidden
temporal_columns_lookup control. buildQuery and the server-side query
builder send each temporal level as a BASE_AXIS column reference carrying
the grain, and drop a dormant grain that has no temporal level or legacy
granularity subject. The MCP temporal-state check accepts a grain whose
subject is a hierarchy level the lookup marks temporal.
… levels

buildQuery and the server-side builder grain only physical columns marked temporal, so an adhoc level alone no longer shows a grain that would be dropped from the query.
@github-actions github-actions Bot added the i18n Namespace | Anything related to localization label Oct 21, 2026
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.27%. Comparing base (d595bec) to head (ba1e5ab).
⚠️ Report is 36 commits behind head on master.

Files with missing lines Patch % Lines
superset/common/form_data_query_context.py 91.66% 1 Missing and 1 partial ⚠️
...onents/controls/FilterControl/AdhocFilter/index.ts 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #45571       +/-   ##
===========================================
+ Coverage   65.35%   84.27%   +18.92%     
===========================================
  Files        3057     3058        +1     
  Lines      201579   202017      +438     
  Branches    47149    47261      +112     
===========================================
+ Hits       131747   170255    +38508     
+ Misses      66866    28518    -38348     
- Partials     2966     3244      +278     
Flag Coverage Δ
hive 34.80% <9.83%> (-0.06%) ⬇️
javascript 80.40% <98.46%> (+0.02%) ⬆️
mysql 52.86% <9.83%> (?)
postgres 52.87% <9.83%> (?)
presto 36.54% <9.83%> (-0.07%) ⬇️
python 87.44% <96.72%> (+34.74%) ⬆️
sqlite 52.63% <9.83%> (+0.04%) ⬆️
unit 81.88% <96.72%> (?)

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.

…ime bucket

A grained temporal level holds the start of its time bucket, so the
drill-to-detail filter compared the column to that single instant: drilling
into a monthly segment returned only the rows stamped exactly at midnight on
the first of the month (usually none). The detail filter for a grained level
now carries the grain that buildQuery applied (the dashboard grain first), the
same way the Timeseries chart drills into its time axis. Raw temporal,
categorical and adhoc levels are unchanged.
The shared check returns a boolean rather than a type predicate, since a false result does not mean the column is adhoc; buildQuery narrows to a physical column itself before building the column reference.
@aminghadersohi

aminghadersohi commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Acceptance run against a local docker-compose-light stack (examples cleaned_sales_data, order_date 2003-01 to 2005-05), head frontend built from the branch, compared with the merge base f9a0d8a in the same env.

  • A Sunburst created through the MCP chart tools with a monthly grain: MCP returns 180 rows; Explore now shows Time Grain = Month and queries the same 180 rows (merge base: no control, 600 daily rows).
  • Explore: Month 180 rows, Year 21 rows; categorical and adhoc hierarchies hide the control and send no grain; removing the temporal level drops the grain.
  • Dashboard Time Grain filter Month → Year regroups the MCP chart, the Explore chart and a chart saved without a grain (29 → 3). A Sunburst saved before this change keeps raw levels until re-saved in Explore (same as the merge base); I added that to the known limitations.
  • Charts saved without a grain send identical Explore query objects at head and merge base (5 charts); dashboard queries differ only by dropping an inert time_grain_sqla on non-temporal charts, same rows.
  • Embedded guest: all charts load, categorical cross-filters apply, and grained references to columns outside the hierarchy (and forged SQL) are rejected with 403.
  • The server-side form-data builder matches the Explore query for 9/9 form_data captured from the browser; MCP row counts match Explore.

Found and fixed in 18f0389 and 98eb82e: drill to detail on a monthly segment returned 0 rows because the detail filter compared order_date to the bucket start without the grain. It now carries the applied grain (dashboard grain first), as the Timeseries chart does, and returns the month's 158 rows. Test: test/Sunburst/EchartsSunburst.test.tsx (two of its three tests fail without the change).

Not changed here, also present on the merge base: a cross-filter from a temporal ring sends the formatted label (order_date == 'October'), so the other charts fail with an invalid timestamp error, and month labels in smart_date show only the month name.

@netlify

netlify Bot commented Oct 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 18f0389
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ad8e7469a8dcb82da447514
😎 Deploy Preview https://deploy-preview-45571--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit ba1e5ab
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6adc3364e6f2eaacb2f60220
😎 Deploy Preview https://deploy-preview-45571--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Oct 21, 2026
A Sunburst drill on a grained temporal ring sends the bucket as a
TEMPORAL_RANGE in local time. Run the ring query and both drill queries
against real rows on a dataset with a 5 hour offset and check each
bucket's drill returns exactly the rows the ring counted.
@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Acceptance of the drill range change, at 9d8c2ac (local docker-compose-light env, examples data).

Drill to detail and Drill by on a grained temporal ring both send the bucket as a TEMPORAL_RANGE and return exactly the bucket's rows. I compared every run against a direct SQL count of the bucket:

Dataset Grain Bucket Drill to detail Drill by (sum) SQL
no offset Day 2005-03-01 18 18 18
no offset Week 2004-11-29 63 63 63
no offset Month 2004-10 159 159 159
no offset Year 2004 1345 1345 1345
Hours offset 5 Day 2004-07-24 18 18 18
Hours offset 5 Week 2004-07-19 66 66 66
Hours offset 5 Month 2004-10 170 170 170
Hours offset 5 Year 2004 1345 1345 1345
Hours offset 5, dashboard Time grain = Year over a saved Month Year 2004 1345 1345 1345

The offset dataset puts each row near a day boundary, so the offset moves rows between months (October 2004: 159 rows without the offset, 170 with it); the ring value and both drills agree on 170.

I added tests/unit_tests/models/test_sunburst_drill_hours_offset.py: it runs the Sunburst ring query and both drill queries on real rows with a 5 hour offset and checks each bucket's drill count equals the ring count. Removing the offset shift on range filters in superset/models/helpers.py makes 3 of its 4 tests fail.

Also re-checked: a Sunburst saved without a grain sends the same drill filters as before this change; embedded guests load the grained charts (8/8), and a forged grained column outside the hierarchy is still rejected (403).

Not related to this change and unchanged from master: Drill by on a temporal ring without a grain still sends the formatted label (for example order_date == 'March') and the query fails. Same root as the existing cross-filter behaviour; I'm tracking it separately.

Screenshots in the description are updated to this head.

@aminghadersohi
aminghadersohi marked this pull request as ready for review October 22, 2026 04:08
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; current tests cover grained Sunburst drill and cross-filter bucket behavior, while Drill by retains its existing last-level-only contract.

Assessed commit: ba1e5ab959ef

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes: the Explore time grain fix (the control, buildQuery and the server-side mirror) is sound, and the embedded-guest anti-tamper check still holds. But the new drill filters return the wrong rows whenever a time range or legacy granularity_sqla applies (details inline).

🟡 Medium — Conflicts with #45598 and contradicts its drill design
Both PRs edit EchartsSunburst.tsx and exploring-data.mdx, and both add test/Sunburst/EchartsSunburst.test.tsx; git merge-tree against #45598's head (37e5c78) reports conflicts in all three. They choose opposite Drill to detail shapes: TEMPORAL_RANGE here, == + grain there. They also duplicate the "is this level grained" check (isGrainedLevel here, getSunburstTimeGrain there), and only #45598's version honours a dashboard Time Column override (extraFormData.granularity_sqla). Fix: pick one drill design, land one PR first, and rebase the other onto a shared helper.

🟡 Medium — Two temporal levels on a semantic view fail in Explore
Both levels become BASE_AXIS columns. _get_grain_time_axis_column (superset/semantic_layers/mapper.py:1298-1320) returns None when more than one temporal dimension is selected, so _validate_granularity (:1500-1505) raises "A time column must be specified when a time grain is provided" (reproduced with an order_date + ship_date view). Before this PR only a dashboard grain override reached this path; the new control makes it a normal Explore action. The new mapper tests cover only one temporal level.

🟢 Low — Unknown or engine-specific grains fall back to an exact-instant match
getTimeBucketRange returns undefined for grains it doesn't handle (PT5S, PT30S, PT0.5H, PT6H, P0.25Y, TIME_GRAIN_ADDONS entries). getTemporalXAxisDrillByFilter then emits {op: '==', val: <bucket start>} with no grain, which matches only rows stamped exactly at the bucket start. Fix: the == + grain shape suggested inline covers every grain; otherwise add grain to the fallback.

🟢 Low — Unrelated changes in the diff
The #: source-location line added to messages.pot is the only one in the file and will go stale. Two unrelated lambdas in tests/unit_tests/security/manager_test.py (around lines 4302 and 4339) were reformatted.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

@rebenitez1802, I applied the review-body changes in 80118e7, with adhoc drill transport in e3492ea:

  • Drill design: both Sunburst actions use raw equality plus grain, and Sunburst/timeGrain.ts is the shared query/render subject resolver, including dashboard Time Column overrides. Regression test: tests/unit_tests/models/test_sunburst_drill_hours_offset.py::test_sunburst_factory_drill_preserves_bucket_with_time_range fails before and passes after.
  • Two temporal semantic levels: each explicitly grained reference is validated/grouped independently. Regression test: tests/unit_tests/semantic_layers/mapper_test.py::test_sunburst_two_explicit_temporal_levels reproduces the two-level failure and unsupported second-level grain case before, and passes after. Semantic drill grain variants are covered too.
  • Engine-specific grains: the drill payload preserves every grain rather than calculating frontend bounds. Regression test: superset-frontend/plugins/plugin-chart-echarts/test/Sunburst/EchartsSunburst.test.tsx — drills retain engine-supported grain %s without calculating bounds fails for the six supplied grain cases before and passes here.
  • Unrelated diff: the translation source-location line is removed. tests/unit_tests/security/manager_test.py is byte-identical to the PR merge base; the existing Sunburst guest regression is retained in tests/unit_tests/security/test_sunburst_guest.py::test_raise_for_access_guest_user_ok_grained_sunburst.

Remaining: landing order and merging the overlapping files with #45598 are not completed here. I did not rebase or edit that branch. This branch supplies the equality-plus-grain drill contract and shared helper for the sibling worker to consume with a normal merge after the first PR lands.

Siblings checked:

  • superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/EchartsSunburst.tsx — fixed in 80118e7
  • superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/timeGrain.ts — fixed in 80118e7
  • superset/semantic_layers/mapper.py — fixed in 80118e7
  • superset/common/query_context_factory.py — fixed in 80118e7
  • superset/models/helpers.py — fixed in 80118e7
  • superset-frontend/plugins/plugin-chart-echarts/src/utils/xAxisDrillByFilter.ts — not affected: Sunburst drills bypass frontend range calculation; unchanged Timeseries/cross-filter range consumers are separate contracts
  • tests/unit_tests/security/manager_test.py — not affected: no remaining PR diff after relocating Sunburst coverage

Final head: 8cc881ab51c29c79d574d7b254933fa7babd3019.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

@rebenitez1802 Follow-up to #45571 (comment)

Remaining: the two getSunburstTimeGrain helpers disagree for a hierarchy with two temporal levels and no explicit Time Column. This PR's shared Sunburst/timeGrain.ts grains every physical temporal level; Sunburst/utils.ts in #45598 only infers a grained level when exactly one temporal level exists, so it grains neither in that two-level case. The landing plan is for this PR to land first; #45598 then merges master and adopts this PR's timeGrain.ts. The overlapping-file conflicts and helper reconciliation remain for that separate worker; I did not edit that branch.

For the broader factory change, I retained the chart-independent behavior and added regression coverage in d4351c6. _process_query_object calls _apply_granularity without a chart-type condition. Table and ECharts time-series charts reach it through chart-data; samples/Drill to detail, saved-context loads, async query reconstruction, tabular queries, and MCP use the same factory. A Time Column/time-range override replaces the default TEMPORAL_RANGE, not an independent equality or membership predicate on that column. Removing those predicates changes the selected rows, not just the query representation.

Evidence: test_non_sunburst_granularity_preserves_independent_filters executes SQL for Table's temporal-range fallback and time-series' temporal x-axis branch. In both, equality returns {a: 1}, membership {a: 1, b: 1}, monthly equality {a: 2, b: 2}, and an equality outside the time window returns {}. Reverting only the factory's operator guard in memory returns {a: 2, b: 2, c: 1} in all eight cases: 8 fail before / 8 pass after. I also extended test_sunburst_factory_drill_preserves_bucket_with_time_range to the actual drill_detail result type; its two explicit-granularity cases fail with that guard removed and pass with it present. The two cases without granularity pass either way, as expected. Documentation and the MCP scope helper's stale description reflect the retained behavior; its conservative refusal policy is unchanged.

Siblings checked:

  • superset/common/query_context_factory.py — fixed in 80118e7; non-Sunburst coverage in d4351c6.
  • superset/views/datasource/utils.py — not affected: Drill to detail and count queries delegate to the same factory; the expanded result-type matrix pins filter retention.
  • superset/charts/schemas.py — not affected: chart-data deserialization delegates to the same factory without a second filter-deletion rule.
  • superset/models/slice.py — not affected: saved contexts delegate to the same factory.
  • superset/common/query_serialization.py — not affected: async reconstruction delegates to the same factory; serialization tests pass.
  • superset/common/tabular_query.py — not affected: tabular execution delegates to the same factory; its tests pass.
  • superset/mcp_service/chart/chart_helpers.py — not affected: form-data construction delegates to the same factory; Sunburst/MCP tests pass.
  • superset/mcp_service/chart/tool/get_chart_data.py — not affected: saved-context and fallback queries use the same factory contract.
  • superset/mcp_service/dashboard_scope.py — not affected: its stricter refusal remains unchanged; only comments/docstring were corrected, and dashboard-scope tests pass.
  • superset/semantic_layers/mapper.py — not affected: explicit grain selection and main/group-limit filter mapping retain their existing regression coverage.

Validation at this head: Docker Python 3.11 runs using pytest -n 2 --dist loadfile --cov=superset with the CI test environment passed 1,407 tests, plus 193 tests for dashboard scope and the guest regression (the guest test is included in both runs). Sunburst/drill/adapter Jest suites passed 128 tests in 14 suites. Changed-file pre-commit run --files ... passed with PATH=/tmp/venv45484/bin:$PATH, whose ruff --version reports 0.9.7, matching requirements/development.txt. All Python runs deselected manual and llm_compliance; no real-model calls were used. docker rm -fv pr45571-python completed; docker ps -a --filter name=pr45571 returned no containers.

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes: the round-1 drill fix works end to end, and the rest of round 1 is addressed apart from the deferred #45598 reconciliation. Three blockers remain, all inline:

  • CI is red on the semantic_layers coverage gate.
  • Existing Explore code writes to the new hidden granularity_sqla control, which silently turns the grain off.
  • The factory change breaks Timeseries Drill to detail under a dashboard Time Column override.

On the round-1 fix: I sent the drill payloads through QueryContextFactory with a dashboard time range, legacy granularity, a Time Column override, and a dataset with an Hours offset (Postgres/SQLite). Each ring bucket returns exactly its own rows.

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes: one narrow blocker remains, with a one-click fix inline. The three round-2 blockers are fixed and CI is green. I also checked the drill fix end to end through get_samples and the CSV/XLSX export. After the #45598 merge, the Hours offset is applied exactly once: shifted in SQL on Postgres/SQLite, inverted on the filter value elsewhere, never both.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

@rebenitez1802 I closed the remaining ask in your review at #45571 (review) .

Fixed in 0fb8d33. I limited the different-Time-Column Sunburst exception to non-extra filters, as suggested. Dashboard cross-filters on the replaced column are dropped; independent Sunburst drill predicates survive.

Regression test: tests/unit_tests/models/test_sunburst_drill_hours_offset.py::test_sunburst_factory_drops_extra_filter_on_replaced_time_column, added in this commit. Through QueryContextFactory.create and SQLite query execution, all three variants (samples, drill_detail, full) failed before the fix (only ['z'] instead of the five expected bucket rows), and pass after. The test also asserts that the independent grain-bearing predicate survives. Docker pytest: 136 focused tests passed; additional branch suites: 859 passed. Jest: 147 passed. Branch-scoped pre-commit passed with repository-pinned Ruff 0.9.7.

Siblings checked:

  • superset/common/query_context_factory.py:437 — fixed in 0fb8d33
  • superset/views/datasource/utils.py:146 — fixed in 0fb8d33
  • superset/charts/schemas.py:1760 — fixed in 0fb8d33
  • superset/charts/data/api.py:773 — fixed in 0fb8d33
  • superset/common/query_serialization.py:120 — fixed in 0fb8d33
  • superset/views/api.py:146 — fixed in 0fb8d33
  • superset/models/slice.py:549 — fixed in 0fb8d33
  • superset/mcp_service/chart/chart_helpers.py:1335 — fixed in 0fb8d33
  • superset/mcp_service/chart/tool/get_chart_data.py:893 — fixed in 0fb8d33
  • superset/common/tabular_query.py:428 — not affected: passes empty form_data, so cannot select the Sunburst exception.
  • superset/tasks/async_queries.py — not affected: reconstruction uses the shared factory; no separate granularity-filter deletion.
  • superset-frontend/packages/superset-ui-core/src/query/buildQueryObject.ts:92 — not affected: already tags dashboard filters isExtra; no producer change needed.
  • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:411 — not affected: original-axis labels remain unchanged; existing swapped-column regression passes and the consumer discards the stale filter.
  • superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/utils.ts — not affected: own drill filters do not carry isExtra; existing different-Time-Column drill regression passes.

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve: every blocker from the earlier rounds is fixed, and CI is green.

  • Sunburst drills use == plus the grain, and the backend no longer overwrites them.
  • The hidden granularity_sqla control is gone.
  • The semantic-layer coverage gate passes.
  • Stale dashboard cross-filters on a replaced Time Column are dropped.
  • After the #45598 merge, the Hours offset is applied exactly once.

One non-blocking suggestion inline, for older Sunbursts on semantic views.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

@rebenitez1802 I checked the approval body; its only remaining suggestion is the legacy semantic-view grain compatibility covered by the two inline threads. Fixed in ba1e5ab. The mirror preserves the grain when the saved lookup is absent or null, but still removes it for an explicit empty lookup.

Regression: tests/unit_tests/common/test_form_data_query_context.py::test_legacy_sunburst_dashboard_grain_without_lookup exercises the shared builder, export fallback, and MCP dashboard override; tests/unit_tests/semantic_layers/mapper_test.py::test_legacy_sunburst_dashboard_grain_reaches_semantic_mapper asserts the mapped temporal dimension's grain. Missing/null cases failed on the pre-fix head (8 failures); all 916 selected Python tests pass after in Docker. The matching frontend regression also fails before and passes after (150 branch Jest tests pass).

Siblings checked:

  • superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/buildQuery.ts:73 — fixed in ba1e5ab
  • superset/common/form_data_query_context.py:647 — fixed in ba1e5ab
  • superset/mcp_service/chart/chart_helpers.py:1243 — fixed in ba1e5ab
  • superset/common/form_data_query_context.py:1773 — fixed in ba1e5ab
  • superset/semantic_layers/mapper.py:1351 — not affected: already infers a single temporal dimension when the grain is retained; pinned by test_legacy_sunburst_dashboard_grain_reaches_semantic_mapper.
  • superset/common/form_data_query_context.py:580 — not affected: pivot temporalization does not remove the extras grain.
  • superset/common/form_data_query_context.py:660 — not affected: box-plot temporalization does not remove the extras grain.
  • superset/common/form_data_query_context.py:682 — not affected: table temporalization does not use the Sunburst grain-removal branch.
  • superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/timeGrain.ts — not affected: drill/label selection does not remove query extras; inferring semantic dimension types on the client is outside this compatibility change.

@aminghadersohi
aminghadersohi merged commit f829175 into apache:master Oct 24, 2026
81 checks passed
hughhhh added a commit that referenced this pull request Oct 26, 2026
- DrillDetailPane.test.tsx and tests/unit_tests/views/datasource/test_utils.py:
  both sides appended tests (this branch's lower-bound Samples paging,
  master's sunburst chart-type tests from #45571); kept both.
- superset/views/datasource/utils.py: #45571 retyped get_samples' payload
  from SamplesPayloadSchema to dict[str, Any] and dropped the import; the
  branch's _count_star_query_context now takes the same type, and the test
  that needed a type: ignore for the old one no longer does.
- Translations: took master's catalogs and re-ran
  scripts/translations/babel_update.sh on a tracked-files snapshot of the
  merged tree; against master only this branch's msgids and each file's
  POT-Creation-Date change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 i18n Namespace | Anything related to localization packages plugins risk:chart-metadata size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants