-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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 ORDER BY on aggregates and GROUPed BY fields #51894
Merged
Merged
Commits on Feb 4, 2020
-
SQL: Fix ORDER BY on aggregates and GROUPed BY fields
Previously, in the in-memory sorting module `LocalAggregationSorterListener` only the aggregate functions where used (grabbed by the `sortingColumns`). As a consequence, if the ORDER BY was also using columns of the GROUP BY clause, (especially in the case of higher priority - before the aggregate functions) wrong results were produced. E.g.: ``` SELECT gender, MAX(salary) AS max FROM test_emp GROUP BY gender ORDER BY gender, max ``` Add all columns of the ORDER BY to the `sortingColumns` so that the `LocalAggregationSorterListener` can use the correct comparators in the underlying PriorityQueue used to implement the in-memory sorting. Fixes: elastic#50355
Configuration menu - View commit details
-
Copy full SHA for b49a23c - Browse repository at this point
Copy the full SHA b49a23cView commit details
Commits on Feb 5, 2020
-
Configuration menu - View commit details
-
Copy full SHA for a68c6de - Browse repository at this point
Copy the full SHA a68c6deView commit details -
Configuration menu - View commit details
-
Copy full SHA for 90cb862 - Browse repository at this point
Copy the full SHA 90cb862View commit details -
Configuration menu - View commit details
-
Copy full SHA for ab0c627 - Browse repository at this point
Copy the full SHA ab0c627View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d25c93 - Browse repository at this point
Copy the full SHA 9d25c93View commit details -
Configuration menu - View commit details
-
Copy full SHA for aaf2bd3 - Browse repository at this point
Copy the full SHA aaf2bd3View commit details
Commits on Feb 11, 2020
-
Configuration menu - View commit details
-
Copy full SHA for a1ec293 - Browse repository at this point
Copy the full SHA a1ec293View commit details -
Configuration menu - View commit details
-
Copy full SHA for 65a1ca3 - Browse repository at this point
Copy the full SHA 65a1ca3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 46b9700 - Browse repository at this point
Copy the full SHA 46b9700View commit details -
Configuration menu - View commit details
-
Copy full SHA for 637a9f9 - Browse repository at this point
Copy the full SHA 637a9f9View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.