You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/03/05 07:16:18 UTC

[GitHub] [superset] villebro commented on pull request #13434: fix(query): properly select adhoc metrics in orderby

villebro commented on pull request #13434:
URL: https://github.com/apache/superset/pull/13434#issuecomment-791210703


   Lots of great improvements here (I'll add review comments later). It seems the root problem here is that the selected column isn't being added to the groupby clause, not the aggregate expression being missing from the select. Also, one thing worthwhile considering is not all db engines require having the order by aggregate expression in the selects:
   ```
   sqlite> select name from birth_names group by name order by sum(num_girls) desc limit 10;
   Jennifer
   Jessica
   Ashley
   Sarah
   Amanda
   Elizabeth
   Melissa
   Michelle
   Kimberly
   Stephanie
   sqlite>
   ```
   While I don't see a lot of use cases where omitting the aggregate in the select, it's not strictly always necessary, and could save unnecessary network bandwidth when not needed. So instead of always adding it to the selects, we might want to introduce a parameter in `BaseEngineSpec` stating whether or not orderby aggregates have to be present in the select.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org