[fix](nereids)add visitMarkJoinReference method in ExpressionDeepCopier (#25874)
This commit is contained in:
@ -276,8 +276,8 @@ public class ExpressionTranslator extends DefaultExpressionVisitor<Expr, PlanTra
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expr visitArrayItemSlot(SlotReference slotReference, PlanTranslatorContext context) {
|
||||
return context.findColumnRef(slotReference.getExprId());
|
||||
public Expr visitArrayItemSlot(ArrayItemReference.ArrayItemSlot arrayItemSlot, PlanTranslatorContext context) {
|
||||
return context.findColumnRef(arrayItemSlot.getExprId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
package org.apache.doris.nereids.trees.copier;
|
||||
|
||||
import org.apache.doris.nereids.trees.expressions.Alias;
|
||||
import org.apache.doris.nereids.trees.expressions.ArrayItemReference;
|
||||
import org.apache.doris.nereids.trees.expressions.Exists;
|
||||
import org.apache.doris.nereids.trees.expressions.ExprId;
|
||||
import org.apache.doris.nereids.trees.expressions.Expression;
|
||||
@ -70,15 +71,14 @@ public class ExpressionDeepCopier extends DefaultExpressionRewriter<DeepCopierCo
|
||||
@Override
|
||||
public Expression visitSlotReference(SlotReference slotReference, DeepCopierContext context) {
|
||||
Map<ExprId, ExprId> exprIdReplaceMap = context.exprIdReplaceMap;
|
||||
ExprId newExprId;
|
||||
if (exprIdReplaceMap.containsKey(slotReference.getExprId())) {
|
||||
ExprId newExprId = exprIdReplaceMap.get(slotReference.getExprId());
|
||||
return slotReference.withExprId(newExprId);
|
||||
newExprId = exprIdReplaceMap.get(slotReference.getExprId());
|
||||
} else {
|
||||
SlotReference newOne = new SlotReference(slotReference.getName(), slotReference.getDataType(),
|
||||
slotReference.nullable(), slotReference.getQualifier());
|
||||
exprIdReplaceMap.put(slotReference.getExprId(), newOne.getExprId());
|
||||
return newOne;
|
||||
newExprId = StatementScopeIdGenerator.newExprId();
|
||||
exprIdReplaceMap.put(slotReference.getExprId(), newExprId);
|
||||
}
|
||||
return slotReference.withExprId(newExprId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,6 +105,21 @@ public class ExpressionDeepCopier extends DefaultExpressionRewriter<DeepCopierCo
|
||||
return newOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression visitArrayItemReference(ArrayItemReference arrayItemSlot, DeepCopierContext context) {
|
||||
Expression arrayExpression = arrayItemSlot.getArrayExpression().accept(this, context);
|
||||
Map<ExprId, ExprId> exprIdReplaceMap = context.exprIdReplaceMap;
|
||||
ArrayItemReference newOne;
|
||||
if (exprIdReplaceMap.containsKey(arrayItemSlot.getExprId())) {
|
||||
newOne = new ArrayItemReference(exprIdReplaceMap.get(arrayItemSlot.getExprId()),
|
||||
arrayItemSlot.getName(), arrayExpression);
|
||||
} else {
|
||||
newOne = new ArrayItemReference(arrayItemSlot.getName(), arrayExpression);
|
||||
exprIdReplaceMap.put(arrayItemSlot.getExprId(), newOne.getExprId());
|
||||
}
|
||||
return newOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression visitExistsSubquery(Exists exists, DeepCopierContext context) {
|
||||
LogicalPlan logicalPlan = LogicalPlanDeepCopier.INSTANCE.deepCopy(exists.getQueryPlan(), context);
|
||||
|
||||
@ -129,7 +129,10 @@ public class ArrayItemReference extends NamedExpression implements ExpectsInputT
|
||||
return ImmutableList.of(ArrayType.of(AnyDataType.INSTANCE_WITHOUT_INDEX));
|
||||
}
|
||||
|
||||
static class ArrayItemSlot extends SlotReference implements SlotNotFromChildren {
|
||||
/**
|
||||
* it is slot representation of ArrayItemReference
|
||||
*/
|
||||
public static class ArrayItemSlot extends SlotReference implements SlotNotFromChildren {
|
||||
/**
|
||||
* Constructor for SlotReference.
|
||||
*
|
||||
@ -142,6 +145,11 @@ public class ArrayItemReference extends NamedExpression implements ExpectsInputT
|
||||
super(exprId, name, dataType, nullable, ImmutableList.of(), null, Optional.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayItemSlot withExprId(ExprId exprId) {
|
||||
return new ArrayItemSlot(exprId, name, dataType, nullable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
|
||||
return visitor.visitArrayItemSlot(this, context);
|
||||
|
||||
@ -221,8 +221,8 @@ public abstract class ExpressionVisitor<R, C>
|
||||
return visitSlot(slotReference, context);
|
||||
}
|
||||
|
||||
public R visitArrayItemSlot(SlotReference arrayItemSlot, C context) {
|
||||
return visit(arrayItemSlot, context);
|
||||
public R visitArrayItemSlot(ArrayItemReference.ArrayItemSlot arrayItemSlot, C context) {
|
||||
return visitSlotReference(arrayItemSlot, context);
|
||||
}
|
||||
|
||||
public R visitMarkJoinReference(MarkJoinSlotReference markJoinSlotReference, C context) {
|
||||
@ -434,7 +434,7 @@ public abstract class ExpressionVisitor<R, C>
|
||||
}
|
||||
|
||||
public R visitVirtualReference(VirtualSlotReference virtualSlotReference, C context) {
|
||||
return visit(virtualSlotReference, context);
|
||||
return visitSlotReference(virtualSlotReference, context);
|
||||
}
|
||||
|
||||
public R visitArrayItemReference(ArrayItemReference arrayItemReference, C context) {
|
||||
|
||||
Reference in New Issue
Block a user