[fix](Nereids) Make the case sensitivity of the result labels compatible with MySQL (#31510)
SQL: SELECT iD FROM t1 before the label was: id after this PR the label will be: iD
This commit is contained in:
@ -107,9 +107,9 @@ public class CheckAfterRewrite extends OneAnalysisRuleFactory {
|
||||
.collect(Collectors.toSet());
|
||||
notFromChildren = removeValidSlotsNotFromChildren(notFromChildren, childrenOutput);
|
||||
if (!notFromChildren.isEmpty()) {
|
||||
if (plan.child(0) instanceof LogicalAggregate) {
|
||||
if (plan.arity() != 0 && 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(", "))));
|
||||
.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,"
|
||||
|
||||
@ -307,7 +307,9 @@ public class SlotBinder extends SubExprAnalyzer {
|
||||
//TODO: handle name parts more than three.
|
||||
throw new AnalysisException("Not supported name: "
|
||||
+ StringUtils.join(nameParts, "."));
|
||||
}).collect(Collectors.toList());
|
||||
})
|
||||
.map(s -> s.withName(unboundSlot.getNameParts().get(unboundSlot.getNameParts().size() - 1)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static boolean compareDbName(String boundedDbName, String unBoundDbName) {
|
||||
|
||||
@ -150,6 +150,16 @@ public class ArrayItemReference extends NamedExpression implements ExpectsInputT
|
||||
return new ArrayItemSlot(exprId, name, dataType, nullable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayItemSlot withName(String name) {
|
||||
return new ArrayItemSlot(exprId, name, dataType, nullable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlotReference withNullable(boolean newNullable) {
|
||||
return new ArrayItemSlot(exprId, name, dataType, nullable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
|
||||
return visitor.visitArrayItemSlot(this, context);
|
||||
|
||||
@ -73,4 +73,9 @@ public class MarkJoinSlotReference extends SlotReference implements SlotNotFromC
|
||||
public MarkJoinSlotReference withExprId(ExprId exprId) {
|
||||
return new MarkJoinSlotReference(exprId, name, existsHasAgg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlotReference withName(String name) {
|
||||
return new MarkJoinSlotReference(exprId, name, existsHasAgg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user