[GitHub] [calcite] chunweilei commented on a change in pull request #1870: [CALCITE-3846] EnumerableMergeJoin: wrong comparison of composite key with null values

2020-03-27 Thread GitBox
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_r399118440
 
 

 ##
 File path: 
linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
 ##
 @@ -3836,6 +3837,7 @@ public void remove() {
 // extra predicate in case of non equi-join, in case of equi-join it will 
be null
 private final Predicate2 extraPredicate;
 private final Function2 resultSelector;
+private final Comparator comparator; // possibly null (compareTo to 
be used in that case)
 private boolean done;
 
 Review comment:
   AFAIK, according to the calcite code convention, the comment is always on 
the top.


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


[GitHub] [calcite] chunweilei commented on a change in pull request #1870: [CALCITE-3846] EnumerableMergeJoin: wrong comparison of composite key with null values

2020-03-26 Thread GitBox
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
+   * https://issues.apache.org/jira/browse/CALCITE-3846;>[CALCITE-3846]
+   * EnumerableMergeJoin: wrong comparison of composite key with null 
values. */
+  @Test public void testMergeJoinWithCompositeKeyAndNullValues() {
+tester(false, new JdbcTest.HrSchema())
+.query("?")
+.withHook(Hook.PLANNER, (Consumer) 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


[GitHub] [calcite] chunweilei commented on a change in pull request #1870: [CALCITE-3846] EnumerableMergeJoin: wrong comparison of composite key with null values

2020-03-26 Thread GitBox
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_r399010788
 
 

 ##
 File path: 
linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
 ##
 @@ -3836,6 +3837,7 @@ public void remove() {
 // extra predicate in case of non equi-join, in case of equi-join it will 
be null
 private final Predicate2 extraPredicate;
 private final Function2 resultSelector;
+private final Comparator comparator; // possibly null (compareTo to 
be used in that case)
 private boolean done;
 
 Review comment:
   Should we put the comment on the top?


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