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

Fix ORDER BY and FILTER on COUNT() columns #247 #248

Merged
merged 2 commits into from May 15, 2019
Merged

Fix ORDER BY and FILTER on COUNT() columns #247 #248

merged 2 commits into from May 15, 2019

Conversation

niklas88
Copy link
Member

This PR fixes #247. Where the first commit just adds a reproducer query to the end to end tests.

It turns out the underlying issue is that the GroupBy operation would use the subtree column indexes to indicate which columns are already sorted. Upstream operations could then assume a wrong pre-existing order and turn HAVING into a binary search on unsorted data or assume an ORDER BY to be a no-op.

previously we were using the column mapping of the child subtree,
however that can be wrong for the result when new columns are added
(e.g. by using COUNT()). Somehow this was masked in previous versions of
the column mapping.
@niklas88 niklas88 merged commit 70a1725 into ad-freiburg:master May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HAVING and ORDER BY broken on COUNT() columns
2 participants