-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
SQL: Allow ordering of groups based on aggregates #35118
Comments
This would be so beneficial -- is this planned for |
@costin also interested, is this something we're still targeting for 6.6? |
No, there was too much work for this to make it into 6.6; it will be addressed in a future version. |
Introduce client-side, custom sorting of groups based on aggregate functions. To allow this, the Analyzer has been extended to push down to underlying Aggregate, aggregate function and the Querier has been extended to identify the case and consume the results in order and sort them based on the given columns. The underlying QueryContainer has been slightly modified to allow a view of the underlying values being extracted as the columns used for sorting might not be requested by the user. The PR also adds minor tweaks, mainly related to tree output. Close elastic#35118
Is there a workaround ? Canvas seems hard to use without the possibility to limit results after an order by counting |
Introduce client-side sorting of groups based on aggregate functions. To allow this, the Analyzer has been extended to push down to underlying Aggregate, aggregate function and the Querier has been extended to identify the case and consume the results in order and sort them based on the given columns. The underlying QueryContainer has been slightly modified to allow a view of the underlying values being extracted as the columns used for sorting might not be requested by the user. The PR also adds minor tweaks, mainly related to tree output. Close #35118
Nice @costin !👌 |
Introduce client-side sorting of groups based on aggregate functions. To allow this, the Analyzer has been extended to push down to underlying Aggregate, aggregate function and the Querier has been extended to identify the case and consume the results in order and sort them based on the given columns. The underlying QueryContainer has been slightly modified to allow a view of the underlying values being extracted as the columns used for sorting might not be requested by the user. The PR also adds minor tweaks, mainly related to tree output. Close elastic#35118 (cherry picked from commit 783c9ed)
Introduce client-side sorting of groups based on aggregate functions. To allow this, the Analyzer has been extended to push down to underlying Aggregate, aggregate function and the Querier has been extended to identify the case and consume the results in order and sort them based on the given columns. The underlying QueryContainer has been slightly modified to allow a view of the underlying values being extracted as the columns used for sorting might not be requested by the user. The PR also adds minor tweaks, mainly related to tree output. Close #35118 (cherry picked from commit 783c9ed)
Composite Aggregation is a very nice feature, it allows to paginate over the distinct values of the field but however sort by only "key/term". Are there any plans to support sort by doc_count desc? Also the Composite Aggregation docs, is not capturing the absence of "sort by doc_count desc" support which the majority of the users are interested in. |
Due to the way composite aggs are currently implemented, one can sort only by the its keys. This is limiting as a good portion of use cases need to do just that:
GROUP BY countries ORDER BY COUNT(*)
The text was updated successfully, but these errors were encountered: