-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: optimize and unparse grouping #16161
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
base: main
Are you sure you want to change the base?
Conversation
Thanks @chenkovsky -- can. you find the original PR that added this |
@eejbyfeldt @comphead could you please help me review this PR? |
it's related to #12704 |
I did not look closely at yet since I have not really contributed here in months.
This extra projection is introduced by But the goal of leaving more structure in logical plan after resolving the grouping expr so that optimization and unparsing sounds reasonable to me. |
Which issue does this PR close?
Rationale for this change
first, it seems that grouping udaf document is not correct.
and for aggregation with grouping,
e.g.
current logical plan is:
the problems are:
there are three projections. for bitwise operation, there's no benifit for extra projection.
it makes grouping level optimization very hard. for example,
we only need to calculate sum(c2) in when grouping(c1) = 1, this is a very useful optimization trick. I'm also using this trick to optimizing sql with multiple count distinct.
unparsing is not supported. Internal("Tried to unproject column referring to internal grouping id") will be thrown.
What changes are included in this PR?
now, the logical plan is:
there are only two projections. and unparsing is supported.
Are these changes tested?
UT
Are there any user-facing changes?
No