-
Notifications
You must be signed in to change notification settings - Fork 16.1k
fix(explore): re-apply filters when 'Group remaining as Others' is enabled #35937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(explore): re-apply filters when 'Group remaining as Others' is enabled #35937
Conversation
Code Review Agent Run #b09b3aActionable Suggestions - 0Additional Suggestions - 8
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Status |
|---|---|---|
| Too Many Parameters in Method ▹ view | ||
| Time filters ignored when granularity is falsy ▹ view | ✅ Fix detected |
Files scanned
| File Path | Reviewed |
|---|---|
| superset/models/helpers.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #35937 +/- ##
===========================================
+ Coverage 0 68.72% +68.72%
===========================================
Files 0 622 +622
Lines 0 45726 +45726
Branches 0 4977 +4977
===========================================
+ Hits 0 31423 +31423
- Misses 0 13058 +13058
- Partials 0 1245 +1245
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SUMMARY
Fixes a bug where charts with "Group remaining as Others" enabled ignore all filters (time range, user filters, RLS filters, custom WHERE clauses).
Problem
When
group_others_when_limit_reached=True, the query is reconstructed withsa.select(select_exprs), creating a new SQLAlchemy Select object that loses previously applied WHERE and HAVING clauses.Solution
_reapply_query_filters()method to systematically re-apply all filters after query reconstructiontime_filtersinitialization - moved beforeif granularity:block to prevent undefined variable error when charts have no time dimensionChanges
superset/models/helpers.py: New method + initialization fix + 2 integration pointstests/unit_tests/models/helpers_test.py: 5 unit tests covering all code pathsBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE: Outer WHERE clause missing when "Group remaining as Others" is enabled

AFTER: Outer WHERE clause correctly applied

TESTING INSTRUCTIONS
Manual Testing
Create a bar chart with:
Verify:
Test edge case: Create chart without time dimension, add filters, enable "Group remaining as Others" - should work without errors
ADDITIONAL INFORMATION
Fixes #35815