Skip to content

Commit

Permalink
remove literal alias from aliasTransferMap
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Mar 6, 2025
1 parent 7b2899a commit e42a98b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
22 changes: 4 additions & 18 deletions fe/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ public Pair<PhysicalRelation, Slot> aliasTransferMapPut(NamedExpression slot, Pa
return aliasTransferMap.put(slot, pair);
}

public void aliasTransferMapRemove(NamedExpression slot) {
aliasTransferMap.remove(slot);
}

public boolean aliasTransferMapContains(NamedExpression slot) {
return aliasTransferMap.containsKey(slot);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.functions.scalar.BitmapContains;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
import org.apache.doris.nereids.trees.plans.AbstractPlan;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.Plan;
Expand Down Expand Up @@ -440,6 +441,21 @@ public PhysicalPlan visitPhysicalProject(PhysicalProject<? extends Plan> project
if (expression.children().isEmpty()) {
continue;
}
/**
* join(#5=#6)
* -->project(null as #5)
* --> any
* -->project(#6)
* --->scan(T[#5, #6])
*
* both left tree and right tree contain exprId=5.
* remove #5 from alias map to avoid generate wrong rf
*/
if (expression instanceof Alias && expression.child(0) instanceof Literal) {
Alias alias = (Alias) expression;
ctx.aliasTransferMapRemove(alias.toSlot());
continue;
}
Expression expr = ExpressionUtils.getSingleNumericSlotOrExpressionCoveredByCast(expression.child(0));
if (expr instanceof NamedExpression
&& ctx.aliasTransferMapContains((NamedExpression) expr)) {
Expand Down

0 comments on commit e42a98b

Please sign in to comment.