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



##########
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:
       @zabetak , @rubenada , thanks for the feedback. You are right: This 
could potentially cause issues with ANTI join that were not happening before. I 
was exploring the method and this is all quite messy since join type semantics 
are mixed with the semantics of the input parameters such as `pushInto`, 
`pushLeft`, and `pushRight`. Fwiw ANTI join + pushInto == true does not seem to 
be handled correctly without this patch either.
   
   I have pushed an addendum that takes a slightly different approach. It 
deprecates the current `classifyFilters` method and creates an alternative that 
does not rely on join type internally, only on input boolean parameters. Then I 
changed all calls to `classifyFilters` to use this new method (I also created 
some utility methods to keep semantics contained within join type). Let me know 
what you think, I can always take a different approach if you have other ideas.




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