morrySnow commented on code in PR #49257: URL: https://github.com/apache/doris/pull/49257#discussion_r2002953796
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/EliminateEmptyRelation.java: ########## @@ -109,15 +109,21 @@ public List<Rule> buildRules() { if (union.getConstantExprsList().isEmpty()) { Plan child = nonEmptyChildren.get(0); List<Slot> unionOutput = union.getOutput(); - List<Slot> childOutput = child.getOutput(); - List<NamedExpression> projects = Lists.newArrayList(); - for (int i = 0; i < unionOutput.size(); i++) { - ExprId id = unionOutput.get(i).getExprId(); - Alias alias = new Alias(id, childOutput.get(i), unionOutput.get(i).getName()); - projects.add(alias); - } + int childIdx = union.children().indexOf(nonEmptyChildren.get(0)); + if (childIdx >= 0) { Review Comment: UT is a better way to test it, because regression test could not ensure child's output is different with regularChildOutput -- 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