Package org.apache.calcite.util
Class Arrow
java.lang.Object
org.apache.calcite.util.Arrow
Represents one functional dependency (Arrow) between two sets of columns,
where each column is identified by its ordinal index.
Arrow models the functional dependency such that the values of the
determinants columns uniquely determine the values of the
dependents columns. In other words, if two rows have the same values
for all determinant columns, they must also have the same values for all
dependent columns. Both determinants and dependents are
ImmutableBitSet column ordinals.
This structure supports arbitrary cardinality for both determinant and dependent column sets, allowing the representation relationships:
- One-to-one:
{0} → {1} - One-to-many:
{0} → {1, 2} - Many-to-one:
{0, 1} → {2} - Many-to-many:
{0, 1} → {2, 3}
Example:
Table schema: [emp_id, name, dept, salary] // ordinals: 0, 1, 2, 3
Arrow: {0} → {1, 2}
Functional dependency: emp_id → {name, dept}
This indicates that the employee ID uniquely determines both the name and department attributes.
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanReturns true if this Arrow is trivial (dependents ⊆ determinants).static Arrowof(int determinant, int dependent) Create Arrow from single determinant to single dependent.static Arrowof(ImmutableBitSet determinants, ImmutableBitSet dependents) Create Arrow from determinant set to dependent set.toString()
-
Method Details
-
of
Create Arrow from determinant set to dependent set. -
of
Create Arrow from single determinant to single dependent. -
getDeterminants
-
getDependents
-
isTrivial
public boolean isTrivial()Returns true if this Arrow is trivial (dependents ⊆ determinants). -
equals
-
hashCode
public int hashCode() -
toString
-