sohardforaname commented on code in PR #11035: URL: https://github.com/apache/doris/pull/11035#discussion_r929680269
########## fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java: ########## @@ -118,6 +121,38 @@ private Plan groupToTreeNode(Group group) { return result.withChildren(childrenNode); } + private static class GroupExpressionAdapter { + private final GroupExpression groupExpr; + + public GroupExpressionAdapter(GroupExpression groupExpr) { + this.groupExpr = groupExpr; + } + + public GroupExpression getGroupExpr() { + return groupExpr; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GroupExpressionAdapter that = (GroupExpressionAdapter) o; + if (that.groupExpr.getPlan() instanceof LogicalOlapScan) { Review Comment: The class is a package class for GroupExpression because the equals() of the latter can not divide UnboundRelation from LogicalScanOlap as their logical properties are the same, but actually they are not the same. ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSlotReference.java: ########## @@ -51,64 +51,64 @@ public class BindSlotReference implements AnalysisRuleFactory { @Override public List<Rule> buildRules() { return ImmutableList.of( - RuleType.BINDING_PROJECT_SLOT.build( - logicalProject().then(project -> { - List<NamedExpression> boundSlots = - bind(project.getProjects(), project.children(), project); - return new LogicalProject<>(flatBoundStar(boundSlots), project.child()); - }) - ), - RuleType.BINDING_FILTER_SLOT.build( - logicalFilter().then(filter -> { - Expression boundPredicates = bind(filter.getPredicates(), filter.children(), filter); - return new LogicalFilter<>(boundPredicates, filter.child()); - }) - ), - RuleType.BINDING_JOIN_SLOT.build( - logicalJoin().then(join -> { - Optional<Expression> cond = join.getCondition() - .map(expr -> bind(expr, join.children(), join)); - return new LogicalJoin<>(join.getJoinType(), cond, join.left(), join.right()); - }) - ), - RuleType.BINDING_AGGREGATE_SLOT.build( - logicalAggregate().then(agg -> { - List<Expression> groupBy = bind(agg.getGroupByExpressions(), agg.children(), agg); - List<NamedExpression> output = bind(agg.getOutputExpressions(), agg.children(), agg); - return agg.withGroupByAndOutput(groupBy, output); - }) - ), - RuleType.BINDING_SORT_SLOT.build( - logicalSort().then(sort -> { - List<OrderKey> sortItemList = sort.getOrderKeys() - .stream() - .map(orderKey -> { - Expression item = bind(orderKey.getExpr(), sort.children(), sort); - return new OrderKey(item, orderKey.isAsc(), orderKey.isNullFirst()); - }).collect(Collectors.toList()); + RuleType.BINDING_PROJECT_SLOT.build( Review Comment: ok, thx -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org