Repository navigation
fix(matrixify): apply dimension filters to all query-specific adhoc filter collections - #43861
Conversation
…ilter collections Matrixify builds a grid of chart cells, injecting a per-cell dimension filter (e.g. country == 'USA') into each cell's formData. That filter was appended only to `adhoc_filters`, so charts with more than one query -- e.g. Mixed Chart, whose query B reads `adhoc_filters_b` and query C reads `adhoc_filters_c` -- silently dropped the slice filter from every query except the first, rendering unfiltered data in those cells. Fan the injected filters out to `adhoc_filters` plus every `adhoc_filters_*` collection present on the formData, so all of a chart's queries are sliced. Non-array values on a matched key are treated as empty, and the reassignment creates new arrays rather than mutating the shared base formData. Adds a MatrixifyGridGenerator unit test asserting the filter reaches every adhoc_filters_* collection (and leaves look-alike keys untouched), plus a Mixed Chart buildQuery test verifying both compiled queries are filtered. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Jenwit Amonpongitsara <[email protected]>
Code Review Agent Run #fc048aActionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43861 +/- ##
=======================================
Coverage 79.42% 79.42%
=======================================
Files 2895 2895
Lines 167997 168006 +9
Branches 38903 38903
=======================================
+ Hits 133434 133443 +9
Misses 32064 32064
Partials 2499 2499
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:
|
Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Jenwit Amonpongitsara <[email protected]>
Code Review Agent Run #2c02d9Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
The current implementation of Regarding the concern about multiple countries: the superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridGenerator.ts |
…cells Covers a mutation scenario a single-value test couldn't catch: if the adhoc_filters fan-out mutated a shared array reference instead of writing a fresh array per cell, a USA/Canada dimension grid would accumulate both countries' predicates in every cell's query-specific filter collections. Co-Authored-By: Claude Sonnet 5 <[email protected]> Signed-off-by: Jenwit Amonpongitsara <[email protected]>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #a6244dActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
Thanks, @jenwitteng. LGTM! Sneaky bug, nice work tracking it down to the query-specific adhoc_filters_* collections. Also glad @sadpandajoe's two-country test case landed before merge, that was the real edge case here.
…ilter collections (#43861) Signed-off-by: Jenwit Amonpongitsara <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> (cherry picked from commit 600db8e)
SUMMARY
Matrixify builds a grid of chart cells, injecting a per-cell dimension filter (e.g.
country == 'USA') into each cell'sformData. That filter was appended only toadhoc_filters.Charts with more than one query route each query through a separate adhoc-filter collection — Mixed Chart reads query A from
adhoc_filters, query B fromadhoc_filters_b, query C fromadhoc_filters_c. As a result, on multi-query charts the Matrixify slice filter was silently dropped from every query except the first, so those cells rendered unfiltered data.This change introduces
appendMatrixifyFilters, which fans the injected filters out toadhoc_filtersplus everyadhoc_filters_*collection present on theformData, so all of a chart's queries are sliced by the cell's dimension value.Design notes:
formData, so cells don't contaminate each other.matrixify_*keys are deleted before the fan-out, so they can't be matched by theadhoc_filters_*pattern.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — behavior fix, no visual/layout change. Effect: Mixed Chart Matrixify cells now filter query B/C data to the cell's dimension value instead of showing the full, unfiltered series.
TESTING INSTRUCTIONS
Manual:
countrywith 2+ values).Automated:
superset-ui-core/.../Matrixify/MatrixifyGridGenerator.test.ts— asserts the dimension filter reachesadhoc_filters,adhoc_filters_b, andadhoc_filters_c(including one that started empty), preserves pre-existing filters, and leaves look-alike keys such asfilters_buntouched.plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts— asserts both compiled queries carry the Matrixify filter and query B's pre-existing free-form filter is preserved.ADDITIONAL INFORMATION