zabetak commented on a change in pull request #1462: 
[CALCITE-3353]ProjectJoinTransposeRule caused AssertionError when creating a 
new Join
URL: https://github.com/apache/calcite/pull/1462#discussion_r327502867
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rules/ProjectJoinTransposeRule.java
 ##########
 @@ -62,10 +65,20 @@
   public ProjectJoinTransposeRule(
       PushProjector.ExprCondition preserveExprCondition,
       RelBuilderFactory relFactory) {
-    super(
-        operand(Project.class,
-            operand(Join.class, any())),
-        relFactory, null);
+    this(
+        operand(LogicalProject.class,
+            operand(LogicalJoin.class, any())),
+            preserveExprCondition, relFactory);
+  }
+
+  /**
+   * Creates a ProjectJoinTransposeRule.
+   */
+  public ProjectJoinTransposeRule(
+      RelOptRuleOperand operand,
+      PushProjector.ExprCondition preserveExprCondition,
+      RelBuilderFactory relFactory) {
+    super(operand, relFactory, null);
 
 Review comment:
   The new constructor is more liberal than it should be; allowing to pass a 
RelOptRuleOperand means that the rule may match something else than Project and 
Join for which it was intended for. 
   
   @jinxing64 Dropping a public constructor breaks backward compatibility so 
ideally it should remain as is (possibly deprecated). Other than that I agree 
with you that we can call directly the new constructor for creating the 
instance.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to