-
Notifications
You must be signed in to change notification settings - Fork 16.2k
fix(cache): apply dashboard filters to non-legacy visualizations in w… #36109
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
fix(cache): apply dashboard filters to non-legacy visualizations in w… #36109
Conversation
Code Review Agent Run #42cf3aActionable Suggestions - 0Additional Suggestions - 11
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.
I've completed my review and didn't find any issues.
Files scanned
| File Path | Reviewed |
|---|---|
| superset/commands/chart/warm_up_cache.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.
alexandrusoare
left a comment
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.
The code looks good overall, just one comment and the CI needs to get fixed
EnxDev
left a comment
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.
Could we add tests for the edge cases?
- Invalid JSON in the
extra_filtersparameter query_contextreturning None- Chart without a datasource (legacy path)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #36109 +/- ##
===========================================
+ Coverage 0 68.30% +68.30%
===========================================
Files 0 629 +629
Lines 0 46198 +46198
Branches 0 5000 +5000
===========================================
+ Hits 0 31554 +31554
- Misses 0 13395 +13395
- Partials 0 1249 +1249
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:
|
|
Comment addressed, CI fixed and tests added. Thanks @alexandrusoare @EnxDev |
EnxDev
left a comment
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.
LGTM, thanks!
) (cherry picked from commit 8315804)
SUMMARY
Fixes a bug where the
/api/v1/dataset/warm_up_cacheAPI endpoint was not applying dashboard filters to non-legacy visualizationsIssue: When warming up cache with a
dashboard_idparameter, legacy visualizations correctly applied dashboard default filters, but non-legacy visualizations ignored them completely, caching unfiltered data.Root cause: In
superset/commands/chart/warm_up_cache.py, the non-legacy visualization code path (lines 77-108 in original) did not check fordashboard_idor retrieve dashboard filters, unlike the legacy path which properly calledget_dashboard_extra_filters().Solution:
_get_dashboard_filters()helper method (DRY principle)Changes:
_get_dashboard_filters(): Retrieves filters fromextra_filtersparameter or dashboard metadata_warm_up_non_legacy_cache(): Applies dashboard filters to each query in the query contextrun(): Reduced complexity from 11 to 3 by delegating to helper methodsThe fix mirrors the existing legacy visualization pattern, ensuring consistent behavior across all visualization types.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - Backend API change only
TESTING INSTRUCTIONS
echarts_timeseries_bar,pie,big_number)json_metadata:{"default_filters": "{\"<chart_id>\": {\"<column_name>\": [\"<value>\"]}}"}PUT /api/v1/dataset/warm_up_cache
{
"db_name": "your_database",
"table_name": "your_table",
"dashboard_id": <dashboard_id>
}