-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[feature](nereids) support pull up predicates from aggregate min/max/avg #42199
base: master
Are you sure you want to change the base?
Conversation
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
run buildall |
TPC-H: Total hot run time: 41433 ms
|
TPC-DS: Total hot run time: 191978 ms
|
ClickBench: Total hot run time: 32.26 s
|
863e2ea
to
6e9fc1a
Compare
run buildall |
0798760
to
07b17d3
Compare
run buildall |
TPC-H: Total hot run time: 41601 ms
|
TPC-DS: Total hot run time: 192714 ms
|
ClickBench: Total hot run time: 33.29 s
|
run feut |
@@ -325,8 +343,8 @@ private ImmutableSet<Expression> getAvailableExpressions(Set<Expression> predica | |||
return ImmutableSet.copyOf(newPredicates); | |||
} | |||
|
|||
private boolean hasAgg(Expression expression) { | |||
return expression.anyMatch(AggregateFunction.class::isInstance); | |||
private boolean supportPullUpAgg(Expression expr) { |
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.
Does it mean the original hasAgg judgement actually contains any unexpected pulled up agg cases, after this restriction?
07b17d3
to
f1e405f
Compare
run buildall |
run cloud_p0 |
run performance |
TPC-H: Total hot run time: 41452 ms
|
TPC-DS: Total hot run time: 196276 ms
|
ClickBench: Total hot run time: 33.03 s
|
f1e405f
to
ecdd072
Compare
run buildall |
TPC-H: Total hot run time: 41598 ms
|
TPC-DS: Total hot run time: 197942 ms
|
ClickBench: Total hot run time: 33.25 s
|
ecdd072
to
7e6e02c
Compare
run buildall |
TPC-H: Total hot run time: 32592 ms
|
TPC-DS: Total hot run time: 186664 ms
|
ClickBench: Total hot run time: 30.29 s
|
7e6e02c
to
9d7d133
Compare
…avg, and add qualifier when pull up predicates from project
9d7d133
to
d9beba2
Compare
run buildall |
TPC-H: Total hot run time: 32422 ms
|
TPC-DS: Total hot run time: 185869 ms
|
ClickBench: Total hot run time: 30.77 s
|
@xzj7019 PTAL |
@@ -379,4 +397,16 @@ private ImmutableSet<Expression> getFiltersFromUnionConstExprs(LogicalUnion unio | |||
} | |||
return ImmutableSet.copyOf(filtersFromConstExprs); | |||
} | |||
|
|||
private Map<Slot, Expression> generateMap(List<NamedExpression> namedExpressions) { |
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.
could u add some comment to explain the purpose of this replace map
} else if (namedExpression instanceof SlotReference) { | ||
replaceMap.putIfAbsent((Slot) namedExpression, namedExpression); |
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.
why put a entry with same key and value? i think it is not necessary
Map<Expression, List<Slot>> expressionSlotMap | ||
= Maps.newHashMapWithExpectedSize(outputExpressions.size()); |
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.
not need to keep order anymore?
if (output instanceof Alias && supportPullUpAgg(output.child(0))) { | ||
expressionSlotMap.computeIfAbsent(output.child(0).child(0), | ||
k -> new ArrayList<>()).add(output.toSlot()); | ||
} |
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.
maybe need add some comment to explain when supportPullUpAgg
return true, output.child(0)
always has one child
@@ -68,9 +77,11 @@ public class PullUpPredicates extends PlanVisitor<ImmutableSet<Expression>, Void | |||
|
|||
Map<Plan, ImmutableSet<Expression>> cache = new IdentityHashMap<>(); | |||
private final boolean getAllPredicates; | |||
private final ExpressionRewriteContext rewriteContext; |
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.
could we add more detail about this rule in the class' comment or in each function's comment?
this pr do 2 things:
1.support pull up predicates from aggregate min/max/avg. e.g.
c<=10 pull up from aggregate to avg(c)<=10, and then pull up from aggregate to t.c1<=10, and with equal join condition,can infer predicate t2.a<=10.
2. carry qualifier when pull up from projects, before this pr, c1<=10 pull up from project to c1<=10. after this pr, c1<=10 pull up from project to t.c1<=10.