Record Class ColumnDefinition
- Record Components:
name- the column name; must not be blanktype- the type of values in this column (scalar or nested); must not be nullprovenance- the column's source-relation origin, ornullif unknown
Type, and optional
source-relation ColumnProvenance.
The type may be a ScalarType (the flat, all-scalar case) or
a nested StructType/ArrayType — relix is an NF² (non-first-
normal-form) algebra in which the classic flat relational model is the special
case where every column is scalar. A column whose nested shape is
unknown (schema-on-read) is typed ScalarType.ANY.
Column names are case-preserved (the declared form is stored as-is), but
all schema-level lookups via Schema.column(String) are case-insensitive.
The optional provenance() records which relation the column came
from and under what name, so that a relation-qualified reference
(rooms.name) resolves precisely above a join even when the physical
column has been renamed to disambiguate a collision. Provenance is
metadata: it deliberately does not participate in
equals(Object)/hashCode(), so two columns with the same name
and type remain equal (and Schema equality — relied upon for
union-compatibility, deduplication, and set operations — is unchanged) whether
or not they carry provenance.
-
Constructor Summary
ConstructorsConstructorDescriptionColumnDefinition(String name, Type type) Convenience constructor for a column with no known provenance — the common case (declared source schemas, projections of computed expressions, and most call sites).ColumnDefinition(String name, Type type, ColumnProvenance provenance) Creates an instance of aColumnDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()— overnameandtypeonly (provenance excluded).booleanmatchesQualified(String qualifier, String columnName) Whether this column's provenance matches the relation-qualified referencequalifier.columnName(case-insensitive).name()Returns the value of thenamerecord component.Returns the value of theprovenancerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Returns a copy of this column with a different physical name, preserving the type and provenance.withProvenance(ColumnProvenance provenance) Returns a copy of this column with the given provenance.
-
Constructor Details
-
ColumnDefinition
Creates an instance of aColumnDefinitionrecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componentprovenance- the value for theprovenancerecord component
-
ColumnDefinition
Convenience constructor for a column with no known provenance — the common case (declared source schemas, projections of computed expressions, and most call sites).- Parameters:
name- the column name; must not be blanktype- the column type; must not be null
-
-
Method Details
-
withProvenance
Returns a copy of this column with the given provenance.- Parameters:
provenance- the source-relation origin; may benullto clear it- Returns:
- a column identical to this one but carrying
provenance
-
withName
Returns a copy of this column with a different physical name, preserving the type and provenance. Used when a join renames a colliding right-side column (physicalname_r) while keeping its(relation, name)origin.- Parameters:
newName- the replacement physical name; must not be blank- Returns:
- a column identical to this one but named
newName
-
matchesQualified
Whether this column's provenance matches the relation-qualified referencequalifier.columnName(case-insensitive). Alwaysfalsewhen the column carries no provenance.- Parameters:
qualifier- the relation qualifiercolumnName- the column name within that relation- Returns:
trueif this column originates fromqualifierunder the namecolumnName
-
equals
Equality is over
nameandtypeonly —provenance()is excluded (see the class Javadoc). -
hashCode
public int hashCode()— overnameandtypeonly (provenance excluded). -
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. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
provenance
Returns the value of theprovenancerecord component.- Returns:
- the value of the
provenancerecord component
-