alex-plekhanov commented on code in PR #12157: URL: https://github.com/apache/ignite/pull/12157#discussion_r2180528704
########## modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/MergeJoinConverterRule.java: ########## @@ -51,7 +52,13 @@ public MergeJoinConverterRule() { @Override public boolean matchesJoin(RelOptRuleCall call) { LogicalJoin logicalJoin = call.rel(0); - return !F.isEmpty(logicalJoin.analyzeCondition().pairs()) && logicalJoin.analyzeCondition().isEqui(); + /** + * TODO might be revised after taking https://issues.apache.org/jira/browse/CALCITE-6927 Review Comment: 1. TODO should not contains fixed ticked. 2. We don't need to expand IS_NOT_DISTINCT_FROM, since know how to deal with it. So, no TODO needed. ########## modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/AbstractIgniteJoin.java: ########## @@ -62,10 +64,23 @@ /** */ public abstract class AbstractIgniteJoin extends Join implements TraitsAwareIgniteRel { + /** */ + protected final JoinInfo joinInfo; + /** */ protected AbstractIgniteJoin(RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, Set<CorrelationId> variablesSet, JoinRelType joinType) { super(cluster, traitSet, ImmutableList.of(), left, right, condition, variablesSet, joinType); + + // TODO Should be revised after taking https://issues.apache.org/jira/browse/CALCITE-6927 + joinInfo = condition.getKind() == SqlKind.IS_NOT_DISTINCT_FROM + ? JoinInfo.of(left, right, condition) + : super.joinInfo; Review Comment: Not working for: ``` @Test public void testMergeJoinIsNotDistinctFrom() { sql("CREATE TABLE t1(t1a INTEGER, t1b INTEGER)"); sql("CREATE INDEX t1_idx ON t1(t1a, t1b)"); sql("CREATE TABLE t2(t2a INTEGER, t2b INTEGER)"); sql("CREATE INDEX t2_idx ON t2(t2a, t2b)"); sql("INSERT INTO t1 VALUES (1, 1), (2, 2)"); sql("INSERT INTO t2 VALUES (0, 0), (1, 1)"); assertQuery("SELECT /*+ MERGE_JOIN */ t1a, t1b FROM t1 JOIN t2 ON t1a IS NOT DISTINCT FROM t2a AND t1b = t2b") .matches(CoreMatchers.not(CoreMatchers.containsString("IgniteSort"))) .returns(1, 1) .check(); } ``` But this reproducer works with: ``` joinInfo = JoinInfo.of(left, right, condition); ``` Let's add planner test after fix this issue -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org