aminghadersohi opened a new pull request, #45486:
URL: https://github.com/apache/superset/pull/45486

   ### SUMMARY
   
   Keep user SIMPLE filters when the query context applies a temporal 
granularity. The previous column-only removal discarded every predicate on that 
column, including comparisons unrelated to the TEMPORAL_RANGE being replaced.
   
   MCP Big Number trendlines inject a neutral TEMPORAL_RANGE alongside user 
filters. Keep that dashboard binding, but remove only the range predicate 
during granularity handling. The shared query-context change also covers other 
chart builders and update/preview paths. Update the related documentation and 
remove a stale explanation of the old behavior.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable (query construction).
   
   Before: generating a Big Number trendline with a saved metric, 
`temporal_column: "resolved"`, no time grain, and `filters: [{"column": 
"resolved", "op": ">=", "value": "2026-01-01"}]` creates the comparison in the 
query payload, but query-context processing removes it.
   
   After: the comparison remains in the processed QueryObject. The generated 
neutral time binding does not override it.
   
   ### TESTING INSTRUCTIONS
   
   Regression tests:
   - `test_big_number_temporal_simple_filter_reaches_query`: saved metric, with 
and without a time grain.
   - `test_chart_temporal_simple_filter_survives_query_processing`: generate 
and update merge paths, with/without the generated binding; temporal XY 
line/bar/area/scatter, both mixed-series queries, Big Number, Waterfall, pivot, 
and non-timeseries controls.
   - `test_apply_granularity_keeps_simple_filters`: same/different granularity 
columns and x-axis/filter fallback branches; retain independent comparisons 
while removing the replaced range.
   
   With the original query-context implementation restored, the new regression 
selection produces **77 failed, 71 passed**. With the change, the same 
selection produces **148 passed**. The passing base cases are controls for 
charts/branches that did not drop the predicate.
   
   Targeted suite: **781 passed**:
   
   ```bash
   PYTHONPATH="$PWD:$PWD/superset-core/src" pytest \
     tests/unit_tests/mcp_service/chart/test_dashboard_time_binding.py \
     tests/unit_tests/mcp_service/chart/test_chart_helpers.py \
     tests/unit_tests/mcp_service/chart/test_compile.py \
     tests/unit_tests/mcp_service/chart/test_preview_utils.py \
     tests/unit_tests/mcp_service/chart/tool/test_generate_chart.py \
     tests/unit_tests/mcp_service/chart/tool/test_update_chart.py \
     tests/unit_tests/mcp_service/chart/tool/test_update_chart_preview.py \
     tests/unit_tests/common/test_query_context_factory.py \
     -q -m 'not manual and not llm_compliance'
   ```
   
   Changed-file pre-commit checks passed:
   
   ```bash
   pre-commit run --files \
     superset/common/query_context_factory.py \
     superset/common/tabular_query.py \
     tests/unit_tests/common/test_query_context_factory.py \
     tests/unit_tests/mcp_service/chart/test_dashboard_time_binding.py \
     docs/docs/using-superset/using-ai-with-superset.mdx
   ```
   
   Manual verification: generate or update a Big Number trendline using the 
configuration above against a dataset containing dates before and after the 
cutoff. Inspect its chart SQL/data and confirm the `>=` predicate remains. 
Repeat with a temporal XY chart and an explicit time grain.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
https://github.com/apache/superset/issues/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
   


-- 
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