Record Class SetRelation
java.lang.Object
java.lang.Record
com.darkcollective.relix.processor.exec.SetRelation
- Record Components:
schema- the schema shared by all rows; never nullrows- the set of unique rows; stored as an unmodifiable view of aLinkedHashSet; never null
- All Implemented Interfaces:
MaterializedRelation
public record SetRelation(Schema schema, SequencedSet<Row> rows)
extends Record
implements MaterializedRelation
A materialised relation that contains only unique rows, preserving the
order in which rows were first inserted — the
Set type in the
IBM flat-collection taxonomy (No Key, Element Equality, Unordered, Unique).
Row equality is structural: two rows are equal if they have the same
schema and all corresponding values are equal (as defined by
Row.equals). LinkedHashSet is used as the
backing store so that insertion order is stable across executions.
This is the natural output type for:
DISTINCT(deduplication of an input bag).UNION(deduplication of two concatenated inputs).INTERSECTION(rows common to both inputs).DIFFERENCE(rows in the left input not in the right).
-
Constructor Summary
ConstructorsConstructorDescriptionSetRelation(Schema schema, SequencedSet<Row> rows) Creates an instance of aSetRelationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif this set contains a row structurally equal torow.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static SetRelationBuilds aSetRelationfrom an ordered stream of rows, silently discarding any duplicates (later occurrences of a row that has already been seen are dropped).rows()Returns the value of therowsrecord component.schema()Returns the value of theschemarecord component.intsize()Number of unique rows.stream()Returns a lazy stream over all rows in this relation.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
of
Builds aSetRelationfrom an ordered stream of rows, silently discarding any duplicates (later occurrences of a row that has already been seen are dropped). -
contains
Returnstrueif this set contains a row structurally equal torow. -
size
public int size()Number of unique rows. -
stream
Description copied from interface:MaterializedRelationReturns a lazy stream over all rows in this relation. The stream may be consumed exactly once.- Specified by:
streamin interfaceMaterializedRelation
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
schema
Returns the value of theschemarecord component.- Specified by:
schemain interfaceMaterializedRelation- Returns:
- the value of the
schemarecord component
-
rows
Returns the value of therowsrecord component.- Returns:
- the value of the
rowsrecord component
-