Interface BuiltInMetadata.FunctionalDependency

All Superinterfaces:
Metadata
Enclosing class:
BuiltInMetadata

public static interface BuiltInMetadata.FunctionalDependency extends Metadata
Metadata about the functional dependencies among columns.
  • Field Details

  • Method Details

    • determines

      @Nullable Boolean determines(int determinant, int dependent)
      Returns whether one column functionally determines another.

      For example, empno functionally determines sal, because empno is the primary key.

      Parameters:
      determinant - 0-based ordinal of determinant column
      dependent - 0-based ordinal of dependent column
      Returns:
      true if determinant uniquely determines dependent; false if not; null if unknown
    • determinesSet

      Boolean determinesSet(ImmutableBitSet determinants, ImmutableBitSet dependents)
      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 that deptno alone determines sal.

      Parameters:
      determinants - 0-based ordinals of determinant columns
      dependents - 0-based ordinals of dependent columns
      Returns:
      true if determinants uniquely determine dependents
    • dependents

      ImmutableBitSet dependents(ImmutableBitSet ordinals)
      Returns the closure of ordinals under the functional dependency set. The closure is the set of column ordinals uniquely determined by ordinals.

      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

      Set<ImmutableBitSet> determinants(ImmutableBitSet ordinals)
      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 {empno determines deptno}, {empno determines {sal, {empno determines job}, 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.