chunweilei commented on a change in pull request #1870: [CALCITE-3846]  
EnumerableMergeJoin: wrong comparison of composite key with null values
URL: https://github.com/apache/calcite/pull/1870#discussion_r399011127
 
 

 ##########
 File path: 
core/src/test/java/org/apache/calcite/test/enumerable/EnumerableJoinTest.java
 ##########
 @@ -220,6 +220,44 @@
             + "empid=150; name=Sebastian; dept_name=Sales; e_deptno=10; 
d_deptno=10");
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-3846";>[CALCITE-3846]
+   * EnumerableMergeJoin: wrong comparison of composite key with null 
values</a>. */
+  @Test public void testMergeJoinWithCompositeKeyAndNullValues() {
+    tester(false, new JdbcTest.HrSchema())
+        .query("?")
+        .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
+          planner.addRule(EnumerableRules.ENUMERABLE_MERGE_JOIN_RULE);
+          planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE);
+        })
+        .withRel(builder -> builder
+            .scan("s", "emps")
+            .sort(builder.field("deptno"), builder.field("commission"))
+            .scan("s", "emps")
+            .sort(builder.field("deptno"), builder.field("commission"))
+            .join(JoinRelType.INNER,
+                builder.and(
+                    builder.equals(
+                        builder.field(2, 0, "deptno"),
+                        builder.field(2, 1, "deptno")),
+                    builder.equals(
+                        builder.field(2, 0, "commission"),
+                        builder.field(2, 1, "commission"))))
+            .project(
+                builder.field("empid"))
+            .build())
+        .explainHookMatches("" // It is important that we have MergeJoin in 
the plan
+            + "EnumerableCalc(expr#0..4=[{inputs}], empid=[$t0])\n"
 
 Review comment:
   The comment seems a little confusing. Why is it important?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to