liyafan82 commented on a change in pull request #2146: URL: https://github.com/apache/calcite/pull/2146#discussion_r486854367
########## File path: core/src/main/java/org/apache/calcite/rel/rules/LoptOptimizeJoinRule.java ########## @@ -2064,7 +2064,7 @@ private static boolean areSelfJoinKeysUnique(RelMetadataQuery mq, // are unique. When removing self-joins, if needed, we'll later add an // IS NOT NULL filter on the join keys that are nullable. Therefore, // it's ok if there are nulls in the unique key. - return RelMdUtil.areColumnsDefinitelyUniqueWhenNullsFiltered(mq, leftRel, + return RelMdUtil.areColumnsDefinitelyUnique(mq, leftRel, joinInfo.leftSet()); } Review comment: @chunweilei Thanks a lot for your careful review. They are different indeed. However, `areColumnsDefinitelyUniqueWhenNullsFiltered` methods could be implemented in a more efficient way. ---------------------------------------------------------------- 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: us...@infra.apache.org