Skip to content
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: Missing applied filters indicator #22137

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Nov 16, 2022

SUMMARY

This PR fixes a bug which is exemplifies all that is wrong with Superset. Spaghetti code (exacerbated by the fact that the native and legacy filters use different form-data encodings) and half baked features—legacy charts vs. ECharts.

Specifically this issue—where the applied filter indicator is missing—seems to only surface for NVD3TimeSeriesViz charts with time comparisons using the non-native temporal filters. The non-native filters seem to encode which filters are applied using the applied_time_extras form-data field which is defined in the merge_extra_filters method via an extraction of the extra_filters field—which is then disposed of.

The problem lies when this method is called multiple times. This the case when Advanced Analytics are used which requires running extra queries and re-evaluating the query object thus re-invoking the merge_extra_filters method, however this time with the extra_filters field missing from the form-data. The result is the applied_time_extras is now empty which translates to the filter indicator not reflecting that the temporal field has been defined. The solution is merely to preserve (as opposed to overwrite) the applied_time_extras field.

Note this issue only impacted the applied filter indicator, i.e., the filters were correctly applied to the underlying chart.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE

Screen Shot 2022-11-15 at 9 31 50 PM

AFTER

Screen Shot 2022-11-15 at 9 33 05 PM

TESTING INSTRUCTIONS

Added unit tests and tested locally.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@john-bodley john-bodley marked this pull request as ready for review November 16, 2022 06:03
@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Merging #22137 (ba07e4f) into master (2f0d5f1) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #22137      +/-   ##
==========================================
- Coverage   66.99%   66.98%   -0.01%     
==========================================
  Files        1832     1832              
  Lines       69922    69921       -1     
  Branches     7571     7571              
==========================================
- Hits        46841    46840       -1     
  Misses      21122    21122              
  Partials     1959     1959              
Flag Coverage Δ
hive 52.60% <50.00%> (-0.01%) ⬇️
mysql 78.15% <100.00%> (-0.01%) ⬇️
postgres 78.21% <100.00%> (-0.01%) ⬇️
presto 52.49% <50.00%> (-0.01%) ⬇️
python 81.38% <100.00%> (-0.01%) ⬇️
sqlite 76.67% <100.00%> (-0.01%) ⬇️
unit 50.85% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/utils/core.py 90.88% <100.00%> (-0.01%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also having trouble understanding the spaghetti code, but the explanation makes sense to me.

@john-bodley john-bodley merged commit e8a0a5e into apache:master Nov 16, 2022
@john-bodley john-bodley deleted the john-bodley--fix-merge-extra-filters branch November 16, 2022 16:07
john-bodley added a commit to airbnb/superset-fork that referenced this pull request Nov 16, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants