[fix](Nereids) check slot from children may produce wrong format err (#31638)

This commit is contained in:
morrySnow
2024-03-01 16:47:27 +08:00
committed by yiguolei
parent 535e3b23ea
commit 493c9d49ea
2 changed files with 8 additions and 6 deletions

View File

@ -108,16 +108,18 @@ public class CheckAfterRewrite extends OneAnalysisRuleFactory {
notFromChildren = removeValidSlotsNotFromChildren(notFromChildren, childrenOutput);
if (!notFromChildren.isEmpty()) {
if (plan.arity() != 0 && plan.child(0) instanceof LogicalAggregate) {
throw new AnalysisException(String.format("%s not in agg's output", notFromChildren
throw new AnalysisException(String.format("%s not in aggregate's output", notFromChildren
.stream().map(NamedExpression::getName).collect(Collectors.joining(", "))));
} else {
throw new AnalysisException(String.format(
"Input slot(s) not in child's output: %s in plan: %s,"
+ " child output is: %s\n" + "plan tree:\n" + plan.treeString(),
"Input slot(s) not in child's output: %s in plan: %s\nchild output is: %s\nplan tree:\n%s",
StringUtils.join(notFromChildren.stream().map(ExpressionTrait::toString)
.collect(Collectors.toSet()), ", "),
plan, plan.children().stream().flatMap(child -> child.getOutput().stream())
.collect(Collectors.toSet())));
plan,
plan.children().stream()
.flatMap(child -> child.getOutput().stream())
.collect(Collectors.toSet()),
plan.treeString()));
}
}
}