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: Remove BASE_AXIS from pre-query #29084

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Jun 5, 2024

SUMMARY

This PR fixes a regression introduced in #21163 where—if enabled—the generic x-axis is incorrectly included in the pre-query (for engines which don’t support JOINs or subqueries) when determining the top-n series.

Specifically, the top-n series are determined for the entire period, i.e., sans the x-axis as a dimension, however within the confines of the generic x-axis said axis is included as a column. This resulted in an explosion of records—via (x, y) pairs—meaning the top-n typically would just be the top-1. The fix is merely to exclude said column when determining the top-n series.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI and tested locally. Sadly writing unit/integration tests for said logic is non-trivial given i) the scale of the get_sqla_query function (which is ~ 700 lines of code), and ii) the lack of associated tests.

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

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.66%. Comparing base (76d897e) to head (1845fc1).
Report is 1094 commits behind head on master.

Files with missing lines Patch % Lines
superset/utils/core.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #29084       +/-   ##
===========================================
+ Coverage   60.48%   83.66%   +23.17%     
===========================================
  Files        1931      518     -1413     
  Lines       76236    37468    -38768     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    31348    -14766     
+ Misses      28017     6120    -21897     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.94% <40.00%> (-0.22%) ⬇️
javascript ?
mysql 77.23% <90.00%> (?)
postgres 77.34% <90.00%> (?)
presto 53.54% <70.00%> (-0.27%) ⬇️
python 83.66% <90.00%> (+20.17%) ⬆️
sqlite 76.79% <90.00%> (?)
unit 59.02% <80.00%> (+1.39%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.



def get_xaxis_label(columns: list[Column] | None) -> str | None:
def get_x_axis_label(columns: list[Column] | None) -> str | None:
Copy link
Member Author

Choose a reason for hiding this comment

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

Renaming for consistency.

def get_base_axis_labels(columns: list[Column] | None) -> tuple[str, ...]:
axis_cols = [
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactoring using shared logic.

@john-bodley john-bodley marked this pull request as ready for review June 5, 2024 16:11
@john-bodley john-bodley merged commit 17d7e7e into apache:master Jun 5, 2024
66 of 67 checks passed
@michael-s-molina michael-s-molina added the v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch label Jun 5, 2024
@john-bodley john-bodley deleted the john-bodley--fix-pre-query branch June 5, 2024 18:07
michael-s-molina pushed a commit that referenced this pull request Jun 5, 2024
michael-s-molina pushed a commit that referenced this pull request Jun 5, 2024
michael-s-molina pushed a commit that referenced this pull request Jun 5, 2024
mistercrunch pushed a commit to preset-io/superset that referenced this pull request Jun 28, 2024
@mistercrunch mistercrunch added 🍒 4.0.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Jul 24, 2024
eschutho pushed a commit that referenced this pull request Jul 24, 2024
irublev pushed a commit to HighviewPower/superset that referenced this pull request Oct 29, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 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/M v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch 🍒 4.0.2 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants