yanlin-Lynn commented on a change in pull request #1557: [CALCITE-3473] Getting
unique result for table scan should contain key column(s)
URL: https://github.com/apache/calcite/pull/1557#discussion_r352955980
##########
File path:
core/src/main/java/org/apache/calcite/rel/metadata/RelMdUniqueKeys.java
##########
@@ -226,6 +227,18 @@ private RelMdUniqueKeys() {}
return ImmutableSet.of();
}
+ public Set<ImmutableBitSet> getUniqueKeys(TableScan rel, RelMetadataQuery mq,
+ boolean ignoreNulls) {
+ final List<ImmutableBitSet> keys = rel.getTable().getKeys();
+ if (keys.isEmpty()) {
+ return null;
+ }
+ for (ImmutableBitSet key : keys) {
+ assert rel.getTable().isKey(key);
+ }
Review comment:
In the case custom table overrides both getKeys() and isKey() method, add
this to make sure they are consistent.
----------------------------------------------------------------
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