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: questioning a few lines that force an ORDER clause #11153

Merged
merged 2 commits into from
Oct 12, 2020

Conversation

mistercrunch
Copy link
Member

SUMMARY

I'm questioning the need for these 2 lines here, and would like to understand what they are about. It seems like this should be handled by the caller if/when needed.

There's nothing really wrong about doing the unnecessary sort apart for the extra cost on the database backend. In the case of the line chart, it may make more sense to sort on time DESC [if anything] to make the forced row LIMIT to show something more consistent.

before

Screen Shot 2020-10-03 at 9 39 34 AM

after

Screen Shot 2020-10-03 at 9 33 47 AM

@mistercrunch mistercrunch changed the title draft: questioning a few lines that force an ORDER clause fix: questioning a few lines that force an ORDER clause Oct 3, 2020
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2020

Codecov Report

Merging #11153 into master will decrease coverage by 4.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11153      +/-   ##
==========================================
- Coverage   65.84%   61.55%   -4.30%     
==========================================
  Files         827      827              
  Lines       39051    39046       -5     
  Branches     3673     3673              
==========================================
- Hits        25715    24036    -1679     
- Misses      13229    14829    +1600     
- Partials      107      181      +74     
Flag Coverage Δ
#cypress ?
#javascript 62.21% <ø> (ø)
#python 61.16% <ø> (-0.15%) ⬇️

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

Impacted Files Coverage Δ
superset/connectors/sqla/models.py 89.53% <ø> (-0.30%) ⬇️
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupColors.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/chart/ChartContainer.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupFormatters.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/reducers/index.js 0.00% <0.00%> (-100.00%) ⬇️
... and 172 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d76f81...cad8a1d. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

I agree with removing this, as the current logic causes a funny from-top-to-bottom sweeping effect (I noticed this once when playing around with low limits). A few alternatives could be ordering by groupby, then __timestamp in descending order so as to get 1) as many complete series and 2) have them start from most recent datapoint like you mentioned. However, I feel we can get back to this later once when we start implementing server side pagination to chart data requests.

@mistercrunch
Copy link
Member Author

Can you think of other things that may break from this? Why is it there in the first place? Maybe the table viz?

@mistercrunch
Copy link
Member Author

@villebro ^^^ ?

@mistercrunch mistercrunch marked this pull request as ready for review October 10, 2020 06:22
@mistercrunch
Copy link
Member Author

I checked and this changes the default behavior of the "Table" visualization where currently, by default is sorts descending on the first metric.

I feel like the right thing to do is to identify the visualization that do rely on this behavior and to explicitly do it for those.

@mistercrunch
Copy link
Member Author

I added the default behavior logic of sorting by main metric DESC in Table when not specified as part of that visualization logic.

@villebro
Copy link
Member

@mistercrunch sorry, I've been having trouble with notifications on GH. I'll review this asap.

@codecov-io
Copy link

codecov-io commented Oct 12, 2020

Codecov Report

Merging #11153 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11153   +/-   ##
=======================================
  Coverage   65.56%   65.56%           
=======================================
  Files         832      832           
  Lines       39393    39394    +1     
  Branches     3592     3592           
=======================================
+ Hits        25828    25829    +1     
  Misses      13456    13456           
  Partials      109      109           
Flag Coverage Δ
#cypress 55.89% <ø> (+<0.01%) ⬆️
#javascript 62.40% <ø> (ø)
#python 60.79% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...tend/src/views/CRUD/data/database/DatabaseList.tsx 82.05% <ø> (ø)
superset/connectors/sqla/models.py 89.74% <ø> (-0.17%) ⬇️
superset/viz.py 57.52% <100.00%> (+0.07%) ⬆️
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 82.53% <0.00%> (+0.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e58730...22aa5c9. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM, and I agree that going forward individual viz' should do this type of custom ordering if needed in buildQuery.

@mistercrunch mistercrunch merged commit ae87b0c into apache:master Oct 12, 2020
@mistercrunch mistercrunch deleted the query_lines branch October 12, 2020 21:53
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* draft: questioning a few lines that force an ORDER clause

* sorting by main metric DESC by default
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.0 labels Mar 12, 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/XS 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants