You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/02/17 22:43:19 UTC

[GitHub] [calcite] zabetak commented on a change in pull request #2349: [CALCITE-4499] FilterJoinRule misses opportunity to push filter to se…

zabetak commented on a change in pull request #2349:
URL: https://github.com/apache/calcite/pull/2349#discussion_r577993154



##########
File path: core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
##########
@@ -2810,19 +2810,14 @@ public static boolean classifyFilters(
       List<RexNode> rightFilters) {
     RexBuilder rexBuilder = joinRel.getCluster().getRexBuilder();
     List<RelDataTypeField> joinFields = joinRel.getRowType().getFieldList();
-    final int nTotalFields = joinFields.size();
     final int nSysFields = 0; // joinRel.getSystemFieldList().size();
     final List<RelDataTypeField> leftFields =
         joinRel.getInputs().get(0).getRowType().getFieldList();
     final int nFieldsLeft = leftFields.size();
     final List<RelDataTypeField> rightFields =
         joinRel.getInputs().get(1).getRowType().getFieldList();
     final int nFieldsRight = rightFields.size();
-
-    // SemiJoin, CorrelateSemiJoin, CorrelateAntiJoin: right fields are not returned
-    assert nTotalFields == (!joinType.projectsRight()
-            ? nSysFields + nFieldsLeft
-            : nSysFields + nFieldsLeft + nFieldsRight);
+    final int nTotalFields = nFieldsLeft + nFieldsRight;

Review comment:
       I may be wrong but I have the impression that with this change if somebody calls the method with an `ANTI` join it might push a condition to the right side and possibly affecting correctness. I don't think it happens at the moment at least with the Calcite rules but it may be worth adding some kind of assertion for extra protection.




----------------------------------------------------------------
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:
users@infra.apache.org