Package com.darkcollective.relix.symbol
Record Class RelationStatistics
java.lang.Object
java.lang.Record
com.darkcollective.relix.symbol.RelationStatistics
- Record Components:
rowCount- the estimated number of rows, if knowncolumnStatistics- per-column statistics, keyed by column name; never nullkeys- candidate keys (each an ordered list of column names that together uniquely identify a row); never null
public record RelationStatistics(OptionalLong rowCount, Map<String,ColumnStatistics> columnStatistics, List<List<String>> keys)
extends Record
Optimizer-facing statistics about a relation — cardinality and structural
metadata gathered from a data source (e.g. a database catalog).
Every field is optional or possibly-empty: a value that was not collected
is represented by OptionalLong.empty() or an empty collection, never a
sentinel. The canonical UNKNOWN instance carries no information and
is the safe default for sources that expose no statistics.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RelationStatisticsA statistics value carrying no information; the default for stat-less sources. -
Constructor Summary
ConstructorsConstructorDescriptionRelationStatistics(OptionalLong rowCount, Map<String, ColumnStatistics> columnStatistics, List<List<String>> keys) Validates and defensively copies the column-statistics map and key lists. -
Method Summary
Modifier and TypeMethodDescriptionReturns the statistics forcolumn, if any were collected.Returns the value of thecolumnStatisticsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.keys()Returns the value of thekeysrecord component.static RelationStatisticsof(long rowCount) Creates a statistics value carrying only a row count.rowCount()Returns the value of therowCountrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNKNOWN
A statistics value carrying no information; the default for stat-less sources.
-
-
Constructor Details
-
RelationStatistics
public RelationStatistics(OptionalLong rowCount, Map<String, ColumnStatistics> columnStatistics, List<List<String>> keys) Validates and defensively copies the column-statistics map and key lists.- Parameters:
rowCount- estimated row count; must not be nullcolumnStatistics- column name → statistics; must not be nullkeys- candidate keys; must not be null
-
-
Method Details
-
of
Creates a statistics value carrying only a row count.- Parameters:
rowCount- the estimated number of rows; must be non-negative- Returns:
- a statistics value with the given row count and no other data
-
column
Returns the statistics forcolumn, if any were collected.- Parameters:
column- the column name (case-sensitive, as stored)- Returns:
- the column statistics, or empty if none were recorded
-
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). -
rowCount
Returns the value of therowCountrecord component.- Returns:
- the value of the
rowCountrecord component
-
columnStatistics
Returns the value of thecolumnStatisticsrecord component.- Returns:
- the value of the
columnStatisticsrecord component
-
keys
Returns the value of thekeysrecord component.- Returns:
- the value of the
keysrecord component
-