LakeShen commented on code in PR #3345: URL: https://github.com/apache/calcite/pull/3345#discussion_r1285763589
########## core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java: ########## @@ -105,6 +106,43 @@ interface Handler extends MetadataHandler<UniqueKeys> { } } + /** + * Metadata about which columns have foreign keys. + */ + public interface ForeignKeys extends Metadata { + MetadataDef<ForeignKeys> DEF = + MetadataDef.of(ForeignKeys.class, ForeignKeys.Handler.class, + BuiltInMethod.FOREIGN_KEYS.method); + + /** + * Extract foreign keys from {@link org.apache.calcite.rel.RelNode}. + * Foreign keys are represented as an {@link org.apache.calcite.util.ImmutableBitSet}, + * where each bit position represents a 0-based output column ordinal. + * + * @param ignoreNulls if true, allow containing null values when determining + * whether the keys are foreign keys + * + * @return bit set of foreign keys(contains intermediate inferred foreign keys), + * or empty if not enough information is available to make that determination + */ + Set<RelOptForeignKey> getForeignKeys(boolean ignoreNulls); Review Comment: Is it @Nullable ? Like this method: ```sql @Nullable Set<ImmutableBitSet> getUniqueKeys(boolean ignoreNulls); ``` -- 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. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org