Class DownsampleColumns
java.lang.Object
com.darkcollective.relix.semantic.internal.DownsampleColumns
Which columns a
DOWNSAMPLE consolidates, and what each one is called.
Two phases need this answer and they must give the same one: schema inference builds the operator's output heading from it, and the executor fills that heading in. When the two decided separately, a column either phase admitted and the other did not became a row of the wrong width. So the rule is stated once, here, and both read it.
The rule
- The grouping keys and the
buckettimestamp come first and are not consolidations — they identify the bucket rather than summarising it. ConsolidationFunction.COUNTsummarises the rows, so it yields a singlecountcolumn reducing no input column at all.- Every other function yields one
<fn>_<column>column per eligible input column: the numeric ones forAVG/SUM, whose arithmetic is defined over nothing else, and every scalar one forMIN/MAX, which compare rather than compute and rank a date or a name as readily as a number. A nested column is never consolidated — an array has no position in the engine's value order.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne consolidated output column, and the input column reduced into it. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe output column a bucket's timestamp lands in.static final StringThe output columnConsolidationFunction.COUNTproduces. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<DownsampleColumns.Consolidation> The consolidated columns aDOWNSAMPLEemits, in output order.
-
Field Details
-
BUCKET_COLUMN
The output column a bucket's timestamp lands in.- See Also:
-
COUNT_COLUMN
The output columnConsolidationFunction.COUNTproduces.- See Also:
-
-
Method Details
-
of
public static List<DownsampleColumns.Consolidation> of(ConsolidationFunction function, List<String> groupingKeys, String timestampColumn, Schema input) The consolidated columns aDOWNSAMPLEemits, in output order.These follow the grouping keys and the
bucketcolumn, which together make up the whole output heading.Taken as loose parts rather than as a
DownsampleNodebecause the executor asks the same question of a physical plan node, which carries these fields and not the logical node they came from.- Parameters:
function- the consolidation; must not be nullgroupingKeys- the bucket's grouping keys, which are not consolidatedtimestampColumn- the column bucketed on, which is not consolidated eitherinput- the schema of the operator's input; must not be null- Returns:
- the consolidations, in output order; never null, possibly empty when no input column is eligible
-