aminghadersohi commented on code in PR #45571:
URL: https://github.com/apache/superset/pull/45571#discussion_r4362921236


##########
superset/common/query_context_factory.py:
##########
@@ -433,6 +437,13 @@ def _apply_granularity(  # noqa: C901
                     filter
                     for filter in query_object.filter
                     if filter["col"] != filter_to_remove
+                    or (
+                        filter["op"] != "TEMPORAL_RANGE"
+                        and (
+                            filter_to_remove == granularity
+                            or (form_data or {}).get("viz_type") == 
"sunburst_v2"

Review Comment:
   Fixed in 0fb8d33d551fe0b1e002e77db518265dead26768. 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 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/views/datasource/utils.py:146 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/charts/schemas.py:1760 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/charts/data/api.py:773 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/common/query_serialization.py:120 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/views/api.py:146 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/models/slice.py:549 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/mcp_service/chart/chart_helpers.py:1335 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - superset/mcp_service/chart/tool/get_chart_data.py:893 — fixed in 
0fb8d33d551fe0b1e002e77db518265dead26768
   - 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.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to