chunweilei commented on a change in pull request #1185: [CALCITE-3012]
areColumnsUnique for FULL OUTER JOIN could return wrong answer when ignoreNulls
is false
URL: https://github.com/apache/calcite/pull/1185#discussion_r279239723
##########
File path:
core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnUniqueness.java
##########
@@ -254,6 +255,13 @@ public Boolean areColumnsUnique(Join rel,
RelMetadataQuery mq,
final ImmutableBitSet leftColumns = leftAndRightColumns.left;
final ImmutableBitSet rightColumns = leftAndRightColumns.right;
+ // for FULL OUTER JOIN if columns contain column from both inputs it is not
+ // guranteed that the result will be unique
+ if (!ignoreNulls && rel.getJoinType() == JoinRelType.FULL
+ && leftColumns.cardinality() > 0 && rightColumns.cardinality() > 0) {
+ return false;
+ }
Review comment:
Should return null(unknown)?
----------------------------------------------------------------
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