Class ProjectingPagesWindowIndex

java.lang.Object
io.trino.operator.window.pattern.ProjectingPagesWindowIndex
All Implemented Interfaces:
InternalWindowIndex, WindowIndex

public class ProjectingPagesWindowIndex extends Object implements InternalWindowIndex
This class represents a WindowIndex with additional "channels" which are not part of the underlying PagesIndex.

The purpose of this class is to provide input for aggregations in a consistent way, regardless of whether the aggregation uses an input channel, or a runtime-evaluated expression as the argument.

The latter case applies to aggregate functions within the DEFINE and MEASURES clauses of row pattern recognition. The aggregated argument can be based on CLASSIFIER() or MATCH_NUMBER() results which are not present in the input, and thus needs to be evaluated at runtime while processing a row.

E.g. for the aggregate function array_agg(lower(CLASSIFIER(X))), there is no input channel containing the aggregated argument, so it is evaluated row by row at runtime and passed in an additional "channel" available to the aggregation's accumulator by a standard WindowIndex interface.

  • Constructor Details

  • Method Details

    • setLabelAndMatchNumber

      public void setLabelAndMatchNumber(int currentPosition, int label, long matchNumber)
    • size

      public int size()
      Specified by:
      size in interface WindowIndex
    • isNull

      public boolean isNull(int channel, int position)
      Specified by:
      isNull in interface WindowIndex
    • getBoolean

      public boolean getBoolean(int channel, int position)
      Specified by:
      getBoolean in interface WindowIndex
    • getLong

      public long getLong(int channel, int position)
      Specified by:
      getLong in interface WindowIndex
    • getDouble

      public double getDouble(int channel, int position)
      Specified by:
      getDouble in interface WindowIndex
    • getSlice

      public io.airlift.slice.Slice getSlice(int channel, int position)
      Specified by:
      getSlice in interface WindowIndex
    • getSingleValueBlock

      public Block getSingleValueBlock(int channel, int position)
      Specified by:
      getSingleValueBlock in interface WindowIndex
    • getObject

      public Object getObject(int channel, int position)
      Specified by:
      getObject in interface WindowIndex
    • appendTo

      public void appendTo(int channel, int position, BlockBuilder output)
      Specified by:
      appendTo in interface WindowIndex
    • getRawBlock

      public Block getRawBlock(int channel, int position)
      Specified by:
      getRawBlock in interface InternalWindowIndex
    • getRawBlockPosition

      public int getRawBlockPosition(int position)
      Specified by:
      getRawBlockPosition in interface InternalWindowIndex
    • toString

      public String toString()
      Overrides:
      toString in class Object