Class WindowAggregateOperator

  • All Implemented Interfaces:
    AutoCloseable, Operator<TransferableBlock>

    public class WindowAggregateOperator
    extends MultiStageOperator
    The WindowAggregateOperator is used to compute window function aggregations over a set of optional PARTITION BY keys, ORDER BY keys and a FRAME clause. The output data will include the projected columns and in addition will add the aggregation columns to the output data. [input columns, aggregate result1, ... aggregate resultN] The window functions supported today are: Aggregation: SUM/COUNT/MIN/MAX/AVG/BOOL_OR/BOOL_AND aggregations [RANGE window type only] Ranking: ROW_NUMBER [ROWS window type only], RANK, DENSE_RANK [RANGE window type only] ranking functions Value: [none] Unlike the AggregateOperator which will output one row per group, the WindowAggregateOperator will output as many rows as input rows. For queries using an 'ORDER BY' clause within the 'OVER()', this WindowAggregateOperator expects that the incoming keys are already ordered based on the 'ORDER BY' keys. No ordering is performed in this operator. The planner should handle adding a 'SortExchange' to do the ordering prior to pipelining the data to the upstream operators wherever ordering is required. Note: This class performs aggregation over the double value of input. If the input is single value, the output type will be input type. Otherwise, the output type will be double. TODO: 1. Add support for additional rank window functions 2. Add support for value window functions 3. Add support for custom frames (including ROWS support) 4. Add support for null direction handling (even for PARTITION BY only queries with custom null direction) 5. Add support for multiple window groups (each WindowAggregateOperator should still work on a single group)