Skip to content

Commit d0ed566

Browse files
committed
restrict join types the rule affects
1 parent 1605c8f commit d0ed566

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/local/PruneJoinOnNullMatchingField.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import java.util.List;
2525

2626
import static org.elasticsearch.xpack.esql.core.expression.Expressions.isGuaranteedNull;
27+
import static org.elasticsearch.xpack.esql.plan.logical.join.JoinTypes.INNER;
28+
import static org.elasticsearch.xpack.esql.plan.logical.join.JoinTypes.LEFT;
2729

2830
/**
2931
* The rule matches a plan pattern having a Join on top of a Project and/or Eval. It then checks if the join's performed on a field which
@@ -36,6 +38,10 @@ public class PruneJoinOnNullMatchingField extends OptimizerRules.OptimizerRule<J
3638

3739
@Override
3840
protected LogicalPlan rule(Join join) {
41+
var joinType = join.config().type();
42+
if ((joinType == INNER || joinType == LEFT) == false) { // other types will have different replacement logic
43+
return join;
44+
}
3945
AttributeMap.Builder<Expression> attributeMapBuilder = AttributeMap.builder();
4046
loop: for (var child = join.left();; child = ((UnaryPlan) child).child()) { // cast is safe as both Project and Eval are UnaryPlans
4147
switch (child) {

0 commit comments

Comments
 (0)