rubenada commented on a change in pull request #2168:
URL: https://github.com/apache/calcite/pull/2168#discussion_r494287567



##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       Other similar operators (e.g. `EnumerableHashJoin`, 
`EnumerableNestedLoopJoin`, `EnumerableBatchNestedLoopJoin`) don't have this 
check in their constructors. In fact, it is not recommended to call these 
constructors directly (unless you know what you are doing) and they are not 
public, so I am ok with their current behavior of "trusting" the `RelTraitSet` 
parameter.
   On the contrary, `EnumerableMergeJoin#create` method is public (as the other 
`create` methods in the other join operators), so it is its responsibility to 
create a valid `traitSet` bafore calling `EnumerableMergeJoin`'s constructor.

##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       Ok, I'm not against having the assertion in the constructor. I'll add it.

##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       I'd prefer to keep it in the unit test, so that we can detect any 
potential regression in the future.

##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       I'd prefer to keep it in the unit test, so that we can detect any 
potential regression in the future.
   Also, I like the idea of systematically adding a new test scenario every 
time we encounter an issue.

##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       Assertion added to `EnumerableMergeJoin`'s constructor.

##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       Ok, I don't mind removing the check from the test. I just want this fix 
merged before next release.

##########
File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
##########
@@ -1618,20 +1619,23 @@ private void checkCollation(RelOptCluster cluster, 
RelOptTable empTable,
     final EnumerableMergeJoin join;
     join = EnumerableMergeJoin.create(project, deptSort,
         rexBuilder.makeLiteral(true), leftKeys, rightKeys, JoinRelType.INNER);
+    assertThat(join.getTraitSet().getConvention(), 
equalTo(EnumerableConvention.INSTANCE));

Review comment:
       Done.




----------------------------------------------------------------
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:
[email protected]


Reply via email to