[enhancement](nereids)throw readable exception when meet missing column in agg's output (#29243)
This commit is contained in:
@ -106,14 +106,18 @@ public class CheckAfterRewrite extends OneAnalysisRuleFactory {
|
||||
.collect(Collectors.toSet());
|
||||
notFromChildren = removeValidSlotsNotFromChildren(notFromChildren, childrenOutput);
|
||||
if (!notFromChildren.isEmpty()) {
|
||||
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(),
|
||||
StringUtils.join(notFromChildren.stream()
|
||||
.map(ExpressionTrait::toString)
|
||||
.collect(Collectors.toSet()), ", "), plan,
|
||||
plan.children().stream()
|
||||
.flatMap(child -> child.getOutput().stream())
|
||||
.collect(Collectors.toSet())));
|
||||
if (plan.child(0) instanceof LogicalAggregate) {
|
||||
throw new AnalysisException(String.format("%s not in agg's output", notFromChildren
|
||||
.stream().map(slot -> slot.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(),
|
||||
StringUtils.join(notFromChildren.stream().map(ExpressionTrait::toString)
|
||||
.collect(Collectors.toSet()), ", "),
|
||||
plan, plan.children().stream().flatMap(child -> child.getOutput().stream())
|
||||
.collect(Collectors.toSet())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user