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

Issues with Sort By on Table viz (for Presto) #13228

Closed
3 tasks done
michellethomas opened this issue Feb 18, 2021 · 1 comment · Fixed by #13739
Closed
3 tasks done

Issues with Sort By on Table viz (for Presto) #13228

michellethomas opened this issue Feb 18, 2021 · 1 comment · Fixed by #13739
Labels
#bug:regression Bugs that are identified as regessions #bug Bug report P1 Priority item - Major viz:charts:table Related to the Table chart

Comments

@michellethomas
Copy link
Contributor

There are a couple of issues with the way Sort By field is generating queries on Table charts for presto. Issues we have found so far have temporary workarounds. All issues are for table charts using the "AGGREGATE" query type.

  1. If there is a metric alias that is the same as the column that is being aggregated, this results in an error for the generated presto query. This used to work and now does not. The workaround is to change the label for the metric. The query generated looks like:
SELECT cola, SUM(num) AS num
FROM table
GROUP BY cola
ORDER BY SUM(num) 

The presto error is: Invalid reference to output projection attribute from ORDER BY aggregation

  1. There is no groupby in the generated sql query if there is no metric listed in the chart. I'm not sure if this was a change from previous behavior but this results in an error if the user tries to add a metric in the Sort By there is no GROUP BY in the query so it errors. Seems like we should be adding a groupby if there is no metric in the AGGREGATION section anyways(?)
  2. If you are adding a Sort By metric where the column is also in the groupby, you then get an error that presto seems to have a problem with doing a MAX in the ORDER BY of an alias or column with the same name in the select SELECT "name" AS "name" or SELECT name with ORDER BY MAX(name) both result in errors. The generated presto query results in the error Invalid reference to output projection attribute from ORDER BY aggregation

Expected results

Charts should not error

Actual results

Charts show presto error

How to reproduce the bug

See above

Environment

(please complete the following information):

  • superset version: master

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

@junlincc @ktmud

@michellethomas michellethomas added P1 Priority item - Major viz:charts:table Related to the Table chart #bug Bug report labels Feb 18, 2021
@junlincc
Copy link
Member

we touched this area recently as well i think? @ktmud let us know if the regression is not related to your change in table chart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug:regression Bugs that are identified as regessions #bug Bug report P1 Priority item - Major viz:charts:table Related to the Table chart
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants