remove calcite AggregateRemoveRule to fix nested group by query with order by in outer query#15237
Merged
soumyava merged 2 commits intoapache:masterfrom Oct 24, 2023
Merged
Conversation
somu-imply
commented
Oct 23, 2023
| false 302662813.16785714333333333333 | ||
| false 304608131.82107142900000000000 | ||
| false 303537640.51502361272727272727 | ||
| false 303537640.515023651272727272727 |
Contributor
Author
There was a problem hiding this comment.
These queries do not compare the query plan. The underlying query plan changed a bit due to removal of the rule hence the change in the terminating decimal places
clintropolis
approved these changes
Oct 24, 2023
Member
clintropolis
left a comment
There was a problem hiding this comment.
sad since we lose some vectorization and it forces some queries into using subqueries, but this will at least let the queries work correctly for now. We really need to revisit this though since this isn't the ideal solution
LakshSingla
pushed a commit
to LakshSingla/druid
that referenced
this pull request
Oct 25, 2023
…order by in outer query (apache#15237) * Fixing nested group by query with order by in outer query * Adding examples
Contributor
Author
|
This will be reverted back in #15241 as it introduces a better solution to solve the issue without needing to change plans for existing queries |
CaseyPan
pushed a commit
to CaseyPan/druid
that referenced
this pull request
Nov 17, 2023
…order by in outer query (apache#15237) * Fixing nested group by query with order by in outer query * Adding examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Consider this query
This currently fails to plan with the stack trace
This is due to the fact that AggregateRemoveRule removes the aggregates and plans the query as a scan over a group by subquery with ordering on a non-time column which Druid does not support atm. In this PR we fix planning by removing the Aggregate remove rule which plans these queries as scan over group by with order by on a non-time column which Druid does not support.
Note: Removal of this rule is the worst case fix for this case. The best case would have been to allow druid to order by on non-time columns. With removal of this rule which would have removed the aggregate from the outer query if the same is present in the inner query we'll see some performance regression for those queries. However with this we ensure that everything in Druid works as same before the Calcite upgrade from 1.21 to 1.35.
This PR has: