JingDas commented on code in PR #3264:
URL: https://github.com/apache/calcite/pull/3264#discussion_r1230251674


##########
core/src/main/java/org/apache/calcite/rel/metadata/BuiltInMetadata.java:
##########
@@ -105,6 +105,44 @@ 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);
+
+    /**
+     * Determines the list of foreign keys for this expression. Foreign keys 
are
+     * represented as an {@link org.apache.calcite.util.ImmutableBitSet}, where
+     * each bit position represents the column ordinal is foreign key.
+     *
+     * @param ignoreNulls if true, ignore null values when determining

Review Comment:
   In our inner join removing scene. It will make a mistake when forein key is 
nullable. because after removing inner join side which contains unique keys, If 
foreign key is nullable, the result will contain some null foreign key result 
wrongly. 
   In other scene, it maybe wants foreign keys containg null. 
   And BuiltInMetadata.ForeignKeys is a common component, so i add 
"ignoreNulls"option for getForeignKeys method. 
   BuiltInMetadata.ForeignKeys can be used for different scene, and in our 
scene it should not contains 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to