Uh oh!
There was an error while loading. Please reload this page.
[feat](Nereids): rewrite sum literal to sum and count - #32244
Conversation
doris-robot
commented
Mar 14, 2024
Thank you for your contribution to Apache Doris. |
keanji-x
commented
Mar 14, 2024
run buildall |
doris-robot
commented
Mar 14, 2024
TPC-H: Total hot run time: 38352 ms |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
keanji-x
commented
Mar 15, 2024
run buildall |
keanji-x
commented
Mar 15, 2024
run buildall |
doris-robot
commented
Mar 15, 2024
TPC-H: Total hot run time: 38452 ms |
keanji-x
commented
Mar 15, 2024
run buildall |
doris-robot
commented
Mar 15, 2024
TPC-H: Total hot run time: 38240 ms |
| newAggOutput.add(namedCount); | ||
| } | ||
| LogicalAggregate<?> newAgg = agg.withAggOutput(ImmutableList.copyOf(newAggOutput)); |
There was a problem hiding this comment.
we should keep group by key at head of output list
There was a problem hiding this comment.
The order of origin output is not changed. It's ok
| for (Expression e : countSumExpr) { | ||
| NamedExpression namedSum = constructSum(e, existedAggFunc); | ||
| NamedExpression namedCount = constructCount(e, existedAggFunc); | ||
| exprToSum.put(e, namedSum.toSlot()); |
There was a problem hiding this comment.
could we try to reduce unnecessary expression compare as far as we can?
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
keanji-x
commented
Mar 19, 2024
run p0 |
keanji-x
commented
Mar 19, 2024
run buildall |
keanji-x
commented
Mar 20, 2024
run buildall |
PR approved by at least one committer and no changes requested. |
keanji-x
commented
Mar 20, 2024
run buildall |
keanji-x
commented
Mar 21, 2024
run buildall |
keanji-x
commented
Mar 21, 2024
run p0 |
PR approved by at least one committer and no changes requested. |
sum(v + 2) => sum(v) + 2*count(v) sum(v - 2) => sum(v) - 2*count(v)
…55543) rule SumLiteralRewrite will rewrite `sum(expr +/- literal) ` ==> `sum(expr) +/- literal * count(expr)` but require `expr` is a slot, this PR remove this restriction, allow expr to be any expression. relate PR: - introduce rule SumLiteralRewrite: #32244 - add cast for `+,-,*, /`, then `sum(a + 10)` will become `sum(cast(a as bigint) + 10)`: #52837
…pache#55543) rule SumLiteralRewrite will rewrite `sum(expr +/- literal) ` ==> `sum(expr) +/- literal * count(expr)` but require `expr` is a slot, this PR remove this restriction, allow expr to be any expression. relate PR: - introduce rule SumLiteralRewrite: apache#32244 - add cast for `+,-,*, /`, then `sum(a + 10)` will become `sum(cast(a as bigint) + 10)`: apache#52837
sum(v + 2) => sum(v) + 2*count(v) sum(v - 2) => sum(v) - 2*count(v)
Proposed changes
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...