-
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: Fix nested ORDER BY #76277
SQL: Fix nested ORDER BY #76277
Conversation
c3baea4
to
9890d36
Compare
9890d36
to
0da612e
Compare
Pinging @elastic/es-ql (Team:QL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Please add a comment to prependSort
on why the order is in reverse (due to the iteration of the tree) and it might not be obvious the connection to the other rules.
for (int i = plan.order().size() - 1; i >= 0; i--) { | ||
Order order = plan.order().get(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo, it's cleaner to use the listIterator
instead of the index
for (ListIterator<Order> i = plan.order().listIterator(); i.hasPrevious(); ) {
Order order = i.previous();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I was looking for something to avoid the index lookup but was not aware of ListIterator
.
@elasticmachine run elasticsearch-ci/part-1 |
* introduce PushDownAndCombineOrderBy optimization * move merging of order by clauses to QueryFolder * address review comments * fix iteration
* introduce PushDownAndCombineOrderBy optimization * move merging of order by clauses to QueryFolder * address review comments * fix iteration
Resolves #76013. Follow up of #75960
As discussed in #75960, the merging of sort orders from multiple
OrderBy
is now implemented in the query folder.