vlsi commented on a change in pull request #2131:
URL: https://github.com/apache/calcite/pull/2131#discussion_r482760653



##########
File path: core/src/main/java/org/apache/calcite/rel/metadata/RelMdUtil.java
##########
@@ -713,9 +714,11 @@ public static Double getJoinRowCount(RelMetadataQuery mq, 
Join join,
       // semijoin filter and pass it to getSelectivity
       RexNode semiJoinSelectivity =
           RelMdUtil.makeSemiJoinSelectivityRexNode(mq, join);
-
+      Double selectivity = mq.getSelectivity(join.getLeft(), 
semiJoinSelectivity);
       return NumberUtil.multiply(
-          mq.getSelectivity(join.getLeft(), semiJoinSelectivity),
+          join.getJoinType() == JoinRelType.SEMI
+              ? selectivity
+              : 1D - selectivity, // ANTI join

Review comment:
       This would fail with NPE in case selectivity is null




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