Class MergedSplitStats
java.lang.Object
org.elasticsearch.xpack.esql.datasources.MergedSplitStats
- All Implemented Interfaces:
SplitStats
Lazily merges statistics from a list of child
SplitStats instances.
Used by CoalescedSplit.splitStats() to expose aggregate statistics for
composite splits without eagerly materializing a full SplitStats.
Each accessor method computes its result on demand by iterating the children. This is appropriate because the optimizer calls these methods at most a few times per planning phase, and the child count is typically small (a few dozen splits).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchildren()Returns the list of child stats that this instance merges.Returns the maximum of children's max values for the named column under the SPI's "implicit nulls" contract.Returns the minimum of children's min values for the named column under the SPI's "implicit nulls" contract: A child that reports a known min value contributes it to the merge viaSplitStats.mergedMin(java.lang.Object, java.lang.Object), regardless of its null count.longcolumnNullCount(String name) Returns the sum of null counts across children for the named column under the SPI's "implicit nulls" contract: a child whose split lacks the column contributes its full row count (every row is an implicit null), and explicit nulls in present columns are summed normally.longcolumnSizeBytes(String name) Returns the sum of per-column sizes across children, or-1if any child returns an unknown size for the column.longcolumnValueCount(String name) Returns the sum of non-null value counts across children for the named column (multivalue-aware), or-1if any child returns-1(the column was not observed in that child's stats).longReturns the sum of children's compressed sizes, or-1if any child reports an unknown compressed size.booleanReturnstrueonly when every child observed the column in its stats.longrowCount()Total row count for this split.longReturns the sum of children's uncompressed sizes, or-1if any child reports an unknown size.toString()
-
Constructor Details
-
MergedSplitStats
-
-
Method Details
-
children
Returns the list of child stats that this instance merges. -
rowCount
public long rowCount()Description copied from interface:SplitStatsTotal row count for this split. Always>= 0.- Specified by:
rowCountin interfaceSplitStats
-
sizeInBytes
public long sizeInBytes()Returns the sum of children's uncompressed sizes, or-1if any child reports an unknown size. A single unknown child poisons the aggregate because we cannot give a meaningful partial sum to the optimizer.- Specified by:
sizeInBytesin interfaceSplitStats
-
compressedSizeInBytes
public long compressedSizeInBytes()Returns the sum of children's compressed sizes, or-1if any child reports an unknown compressed size.- Specified by:
compressedSizeInBytesin interfaceSplitStats
-
columnNullCount
Returns the sum of null counts across children for the named column under the SPI's "implicit nulls" contract: a child whose split lacks the column contributes its full row count (every row is an implicit null), and explicit nulls in present columns are summed normally. Returns-1only if a child returns-1, which signals the rare "column physically present but stats unknown" case (Parquet stats disabled).- Specified by:
columnNullCountin interfaceSplitStats
-
columnValueCount
Returns the sum of non-null value counts across children for the named column (multivalue-aware), or-1if any child returns-1(the column was not observed in that child's stats). A single unavailable child poisons the aggregate because the summed COUNT(col) would otherwise under-count that child's rows; the caller then falls back torowCount - columnNullCount.- Specified by:
columnValueCountin interfaceSplitStats
-
hasColumn
Returnstrueonly when every child observed the column in its stats. A single child that lacks the column makes the merged answer "not fully harvested": for a text-format multi-file query where one file's scan harvested the column and another's did not, the mergedCOUNT(col)cannot be served from stats without under-counting the unharvested file's rows, so the all-children predicate forces a safe-miss. Footer formats never consult this (theirAggregatePushdownSupportapplies implicit nulls), so genuinely-absent columns in a UNION_BY_NAME mix are unaffected.- Specified by:
hasColumnin interfaceSplitStats
-
columnMin
Returns the minimum of children's min values for the named column under the SPI's "implicit nulls" contract:- A child that reports a known min value contributes it to the merge via
SplitStats.mergedMin(java.lang.Object, java.lang.Object), regardless of its null count. A min stat is the minimum of the column's non-null values, so it is a valid extremum candidate even when the child's null count is unknown (columnNullCount(name) < 0) — null count only bears onCOUNT, never onMIN/MAX. This is the multi-FILE case where a per-fileSplitStatscarries a folded min/max but its null_count was poison-dropped during that file's own multi-stripe fold. - A child with no min value is then classified by its null count:
columnNullCount(name) == child.rowCount()means the column is absent or all-null, so the child has no candidate and is skipped;columnNullCount(name) < 0(present but stats unknown — e.g. Parquet stats disabled) poisons the aggregate because the child may hold a smaller value we cannot see; a finite null count below the row count with no min is an inconsistent reader output and poisons defensively.
nullwhen poisoned or when no child contributes a value.- Specified by:
columnMinin interfaceSplitStats
- A child that reports a known min value contributes it to the merge via
-
columnMax
Returns the maximum of children's max values for the named column under the SPI's "implicit nulls" contract. MirrorscolumnMin(java.lang.String)— a child with a known max contributes it regardless of its null count (null count bears only onCOUNT); a child with no max is skipped when the column is absent/all-null and otherwise poisons defensively.- Specified by:
columnMaxin interfaceSplitStats
-
columnSizeBytes
Returns the sum of per-column sizes across children, or-1if any child returns an unknown size for the column.- Specified by:
columnSizeBytesin interfaceSplitStats
-
toString
-