morrySnow commented on code in PR #46627: URL: https://github.com/apache/doris/pull/46627#discussion_r1908249587
########## fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/ProjectAggregateExpressionsForCse.java: ########## @@ -102,8 +103,16 @@ public Plan visitPhysicalHashAggregate(PhysicalHashAggregate<? extends Plan> agg } if (aggregate.child() instanceof PhysicalProject) { + List<NamedExpression> newProjections = Lists.newArrayList(); PhysicalProject<? extends Plan> project = (PhysicalProject<? extends Plan>) aggregate.child(); - List<NamedExpression> newProjections = Lists.newArrayList(project.getProjects()); + Set<Slot> newInputSlots = aggOutputReplaced.stream() + .flatMap(expr -> expr.getInputSlots().stream()) + .collect(Collectors.toSet()); + for (NamedExpression expr : project.getProjects()) { + if (!(expr instanceof SlotReference) || newInputSlots.contains(expr)) { Review Comment: why need `!(expr instanceof SlotReference)`? ########## fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java: ########## @@ -957,7 +957,13 @@ public PlanFragment visitPhysicalHashAggregate( // 1. generate slot reference for each group expression List<SlotReference> groupSlots = collectGroupBySlots(groupByExpressions, outputExpressions); ArrayList<Expr> execGroupingExpressions = groupByExpressions.stream() - .map(e -> ExpressionTranslator.translate(e, context)) + .map(e -> { + Expr result = ExpressionTranslator.translate(e, context); + if (result == null) { + throw new RuntimeException("translate " + e + " failed"); + } + return result; Review Comment: could we get more info about translate failed and print them in log? -- 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