morrySnow commented on code in PR #65095:
URL: https://github.com/apache/doris/pull/65095#discussion_r3518700009
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/SetPreAggStatus.java:
##########
@@ -178,56 +181,70 @@ public Plan visitLogicalOlapScan(LogicalOlapScan
logicalOlapScan, Stack<PreAggIn
}
@Override
- public Plan visitLogicalFilter(LogicalFilter<? extends Plan>
logicalFilter, Stack<PreAggInfoContext> context) {
+ public Plan visitLogicalFilter(LogicalFilter<? extends Plan> logicalFilter,
+ Map<RelationId, PreAggInfoContext> context) {
+ Set<RelationId> beforeKeys = new HashSet<>(context.keySet());
LogicalFilter plan = (LogicalFilter) super.visit(logicalFilter,
context);
- if (!context.empty()) {
- context.peek().addFilterConjuncts(plan.getExpressions());
+ Set<RelationId> childKeys = new HashSet<>(context.keySet());
+ childKeys.removeAll(beforeKeys);
+ for (RelationId id : childKeys) {
+ context.get(id).addFilterConjuncts(plan.getExpressions());
}
return plan;
}
@Override
public Plan visitLogicalJoin(LogicalJoin<? extends Plan, ? extends Plan>
logicalJoin,
- Stack<PreAggInfoContext> context) {
+ Map<RelationId, PreAggInfoContext> context) {
+ Set<RelationId> beforeKeys = new HashSet<>(context.keySet());
LogicalJoin plan = (LogicalJoin) super.visit(logicalJoin, context);
- if (!context.empty()) {
- context.peek().addJoinInfo(plan);
+ Set<RelationId> childKeys = new HashSet<>(context.keySet());
+ childKeys.removeAll(beforeKeys);
+ for (RelationId id : childKeys) {
+ context.get(id).addJoinInfo(plan);
}
return plan;
}
@Override
public Plan visitLogicalProject(LogicalProject<? extends Plan>
logicalProject,
- Stack<PreAggInfoContext> context) {
+ Map<RelationId, PreAggInfoContext> context) {
+ Set<RelationId> beforeKeys = new HashSet<>(context.keySet());
LogicalProject plan = (LogicalProject) super.visit(logicalProject,
context);
- if (!context.empty()) {
- context.peek().setReplaceMap(plan.getAliasToProducer());
+ Set<RelationId> childKeys = new HashSet<>(context.keySet());
+ childKeys.removeAll(beforeKeys);
+ for (RelationId id : childKeys) {
+ context.get(id).setReplaceMap(plan.getAliasToProducer());
}
return plan;
}
@Override
public Plan visitLogicalAggregate(LogicalAggregate<? extends Plan>
logicalAggregate,
- Stack<PreAggInfoContext> context) {
+ Map<RelationId, PreAggInfoContext> context) {
Review Comment:
agg -> join
join -> agg
生成一个空context
后续遍历
再处理这里context
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]