[fix](nereids) non-slotreference expr in order by lead to plan failed (#14895)
This commit is contained in:
@ -1099,18 +1099,21 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
|
||||
private TupleDescriptor generateTupleDesc(List<Slot> slotList, List<OrderKey> orderKeyList,
|
||||
PlanTranslatorContext context, Table table) {
|
||||
TupleDescriptor tupleDescriptor = context.generateTupleDesc();
|
||||
tupleDescriptor.setTable(table);
|
||||
Set<ExprId> alreadyExists = Sets.newHashSet();
|
||||
tupleDescriptor.setTable(table);
|
||||
for (OrderKey orderKey : orderKeyList) {
|
||||
SlotReference slotReference;
|
||||
if (orderKey.getExpr() instanceof SlotReference) {
|
||||
SlotReference slotReference = (SlotReference) orderKey.getExpr();
|
||||
// TODO: trick here, we need semanticEquals to remove redundant expression
|
||||
if (alreadyExists.contains(slotReference.getExprId())) {
|
||||
continue;
|
||||
}
|
||||
context.createSlotDesc(tupleDescriptor, (SlotReference) orderKey.getExpr());
|
||||
alreadyExists.add(slotReference.getExprId());
|
||||
slotReference = (SlotReference) orderKey.getExpr();
|
||||
} else {
|
||||
slotReference = (SlotReference) new Alias(orderKey.getExpr(), orderKey.getExpr().toString()).toSlot();
|
||||
}
|
||||
// TODO: trick here, we need semanticEquals to remove redundant expression
|
||||
if (alreadyExists.contains(slotReference.getExprId())) {
|
||||
continue;
|
||||
}
|
||||
context.createSlotDesc(tupleDescriptor, slotReference);
|
||||
alreadyExists.add(slotReference.getExprId());
|
||||
}
|
||||
for (Slot slot : slotList) {
|
||||
if (alreadyExists.contains(slot.getExprId())) {
|
||||
|
||||
Reference in New Issue
Block a user