Record Class ColumnProvenance

java.lang.Object
java.lang.Record
com.darkcollective.relix.symbol.ColumnProvenance
Record Components:
relation - the name of the relation the column originates from (its declared name, or the re-anchored name after a relation-rename ρ R (…)); must not be blank
column - the column's name within that relation (its logical name, which may differ from the possibly-suffixed physical name in the concatenated schema); must not be blank

public record ColumnProvenance(String relation, String column) extends Record
The source-relation origin of a schema ColumnDefinition — which relation a column came from, and under what name, so that a relation-qualified reference (rooms.name) can be resolved precisely even after a join has renamed the physical column to disambiguate a collision.

A join concatenates two schemas; when both sides expose a column of the same name the right side's is renamed with an _r suffix (Schema.concat(Schema)). The renamed column's physical name is now name_r, but its provenance still records (rooms, name) — so rooms.name resolves to it, while devices.name resolves to the un-renamed name on the left. Ambiguity is impossible by construction: a qualified reference matches at most one column, and a stale qualifier (relation not in scope) resolves to none — a validation error rather than a silent unqualified first-match.

Both fields are matched case-insensitively at resolution time, consistent with the rest of relix's name handling.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ColumnProvenance(String relation, String column)
    Creates an instance of a ColumnProvenance record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the column record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    matches(String qualifier, String columnName)
    Whether this provenance is for the relation named qualifier and the column named columnName, compared case-insensitively.
    reanchor(String newRelation)
    Returns a copy of this provenance re-anchored to a different relation, keeping the same logical column name.
    Returns the value of the relation record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ColumnProvenance

      public ColumnProvenance(String relation, String column)
      Creates an instance of a ColumnProvenance record class.
      Parameters:
      relation - the value for the relation record component
      column - the value for the column record component
  • Method Details

    • matches

      public boolean matches(String qualifier, String columnName)
      Whether this provenance is for the relation named qualifier and the column named columnName, compared case-insensitively.
      Parameters:
      qualifier - the relation qualifier to match; must not be null
      columnName - the column name to match; must not be null
      Returns:
      true if both match case-insensitively
    • reanchor

      public ColumnProvenance reanchor(String newRelation)
      Returns a copy of this provenance re-anchored to a different relation, keeping the same logical column name. Used by a whole-relation rename ρ NewName (…), which re-labels every column's origin to NewName.
      Parameters:
      newRelation - the new relation name; must not be blank
      Returns:
      the re-anchored provenance
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • relation

      public String relation()
      Returns the value of the relation record component.
      Returns:
      the value of the relation record component
    • column

      public String column()
      Returns the value of the column record component.
      Returns:
      the value of the column record component