Package org.apache.calcite.rel.metadata
Interface BuiltInMetadata.FunctionalDependency
- All Superinterfaces:
Metadata
- Enclosing class:
BuiltInMetadata
Metadata about the functional dependencies among columns.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceHandler API. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondependents(ImmutableBitSet ordinals) Returns the closure ofordinalsunder the functional dependency set.determinants(ImmutableBitSet ordinals) Finds minimal determinant sets for the given dependent columns under the functional dependency set.@Nullable Booleandetermines(int determinant, int dependent) Returns whether one column functionally determines another.determinesSet(ImmutableBitSet determinants, ImmutableBitSet dependents) Returns whether a set of columns functionally determines another set of columns.getFDs()Returns the full set of functional dependencies.
-
Field Details
-
DEF
-
-
Method Details
-
determines
Returns whether one column functionally determines another.For example,
empnofunctionally determinessal, becauseempnois the primary key.- Parameters:
determinant- 0-based ordinal of determinant columndependent- 0-based ordinal of dependent column- Returns:
trueif determinant uniquely determines dependent;falseif not;nullif unknown
-
determinesSet
Returns whether a set of columns functionally determines another set of columns.For example, {
empno,deptno} functionally determines {sal,job}, because the determinant (empno,deptno) is a superset of a key. If we know that {deptno,job} functionally determines {sal} then we cannot deduce thatdeptnoalone determinessal.- Parameters:
determinants- 0-based ordinals of determinant columnsdependents- 0-based ordinals of dependent columns- Returns:
- true if determinants uniquely determine dependents
-
dependents
Returns the closure ofordinalsunder the functional dependency set. The closure is the set of column ordinals uniquely determined byordinals.For example, if input is {
empno,deptno}, and functional dependencies contains {empno,deptno} determines {sal,job}, then returns {empno,deptno,sal,job}.- Parameters:
ordinals- 0-based ordinals of determinant columns- Returns:
- closure: columns functionally determined by
ordinals
-
determinants
Finds minimal determinant sets for the given dependent columns under the functional dependency set.For example, if input is {
empno,deptno,sal,job}, and functional dependencies contains {empnodeterminesdeptno}, {empnodetermines {sal, {empnodeterminesjob}, then returns {empno}.- Parameters:
ordinals- 0-based ordinals of dependent columns- Returns:
- sets of minimal determinant columns
-
getFDs
ArrowSet getFDs()Returns the full set of functional dependencies.
-