java.lang.Object
com.darkcollective.relix.semantic.internal.DownsampleColumns

public final class DownsampleColumns extends Object
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 bucket timestamp come first and are not consolidations — they identify the bucket rather than summarising it.
  • ConsolidationFunction.COUNT summarises the rows, so it yields a single count column reducing no input column at all.
  • Every other function yields one <fn>_<column> column per eligible input column: the numeric ones for AVG/SUM, whose arithmetic is defined over nothing else, and every scalar one for MIN/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.
  • Field Details

  • Method Details

    • of

      public static List<DownsampleColumns.Consolidation> of(ConsolidationFunction function, List<String> groupingKeys, String timestampColumn, Schema input)
      The consolidated columns a DOWNSAMPLE emits, in output order.

      These follow the grouping keys and the bucket column, which together make up the whole output heading.

      Taken as loose parts rather than as a DownsampleNode because 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 null
      groupingKeys - the bucket's grouping keys, which are not consolidated
      timestampColumn - the column bucketed on, which is not consolidated either
      input - 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