mihaibudiu commented on code in PR #4566:
URL: https://github.com/apache/calcite/pull/4566#discussion_r2411859108
##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdFunctionalDependency.java:
##########
@@ -64,212 +78,395 @@ protected RelMdFunctionalDependency() {}
return BuiltInMetadata.FunctionalDependency.DEF;
}
+ /**
+ * Determines whether the specified column is functionally dependent on the
given key.
+ *
+ * @param rel Relational node
+ * @param mq Metadata query
+ * @param determinant Determinant column ordinal
+ * @param dependent Dependent column ordinal
+ * @return true if column is functionally dependent on key, false otherwise
+ */
public @Nullable Boolean determines(RelNode rel, RelMetadataQuery mq,
- int key, int column) {
- return determinesImpl2(rel, mq, key, column);
+ int determinant, int dependent) {
+ return determinesSet(rel, mq, ImmutableBitSet.of(determinant),
ImmutableBitSet.of(dependent));
+ }
+
+ /**
+ * Determines whether a set of columns functionally determines another set
of columns.
+ *
+ * @param rel Relational node
+ * @param mq Metadata query
+ * @param determinants Determinant column set
+ * @param dependents Dependent column set
+ * @return true if dependents are functionally determined by determinants,
false otherwise
+ */
+ public Boolean determinesSet(RelNode rel, RelMetadataQuery mq,
+ ImmutableBitSet determinants, ImmutableBitSet dependents) {
+ ArrowSet fdSet = getFDs(rel, mq);
Review Comment:
At the very least you can add a TODO about caching.
--
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]