-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: alias group_by exprs in single_distinct_to_groupby optimizer #3305
Conversation
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #3305 +/- ##
==========================================
- Coverage 85.83% 85.75% -0.09%
==========================================
Files 293 294 +1
Lines 53170 53750 +580
==========================================
+ Hits 45637 46091 +454
- Misses 7533 7659 +126
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
input.schema().metadata().clone(), | ||
) | ||
.unwrap(); | ||
let grouped_agg = LogicalPlan::Aggregate(Aggregate { | ||
let grouped_aggr = LogicalPlan::Aggregate(Aggregate { |
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.
Please use Aggregate::try_new
here, once #3286 is merged
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.
have removed all unwrap
s
Signed-off-by: Ruihang Xia <[email protected]>
test failure caused by #3327 |
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.
This looks good to me -- thanks @waynexia
Sorry for the delay in reviews -- I was out for a week and the DataFusion has been very busy |
Thanks! I've reviewed 94c014e and it looks fine 👍 |
Thanks again @waynexia |
Benchmark runs are scheduled for baseline = d16457a and contender = 79922b4. 79922b4 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Signed-off-by: Ruihang Xia [email protected]
Which issue does this PR close?
Closes #2994.
Rationale for this change
The original issue is apache/horaedb#59, and a minimal reproducer can be found in #2994.
This is trying to fix the
single_distinct_to_groupby
optimizer cannot handle aGROUP BY
with an expression, likeGROUP BY c+1
. To fix this, we need to alias the "original" GROUP BY in the subquery and refer to that aliased column in outer. E.g.:After optimize
What changes are included in this PR?
group_by
exprsgroup_by_with_expr
Are there any user-facing changes?
No