Class WindowAggregateOperator
- java.lang.Object
-
- org.apache.pinot.query.runtime.operator.MultiStageOperator
-
- org.apache.pinot.query.runtime.operator.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)
-
-
Field Summary
-
Fields inherited from class org.apache.pinot.query.runtime.operator.MultiStageOperator
_context, _opChainStats, _operatorId
-
-
Constructor Summary
Constructors Constructor Description WindowAggregateOperator(OpChainExecutionContext context, MultiStageOperator inputOperator, List<RexExpression> groupSet, List<RexExpression> orderSet, List<org.apache.calcite.rel.RelFieldCollation.Direction> orderSetDirection, List<org.apache.calcite.rel.RelFieldCollation.NullDirection> orderSetNullDirection, List<RexExpression> aggCalls, int lowerBound, int upperBound, WindowNode.WindowFrameType windowFrameType, List<RexExpression> constants, DataSchema resultSchema, DataSchema inputSchema)WindowAggregateOperator(OpChainExecutionContext context, MultiStageOperator inputOperator, List<RexExpression> groupSet, List<RexExpression> orderSet, List<org.apache.calcite.rel.RelFieldCollation.Direction> orderSetDirection, List<org.apache.calcite.rel.RelFieldCollation.NullDirection> orderSetNullDirection, List<RexExpression> aggCalls, int lowerBound, int upperBound, WindowNode.WindowFrameType windowFrameType, List<RexExpression> constants, DataSchema resultSchema, DataSchema inputSchema, Map<String,Function<DataSchema.ColumnDataType,AggregationUtils.Merger>> mergers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MultiStageOperator>getChildOperators()protected TransferableBlockgetNextBlock()StringtoExplainString()-
Methods inherited from class org.apache.pinot.query.runtime.operator.MultiStageOperator
cancel, close, getOperatorId, nextBlock, shouldCollectStats
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.core.common.Operator
explainPlan, getExecutionStatistics, getIndexSegment, prepareForExplainPlan
-
-
-
-
Constructor Detail
-
WindowAggregateOperator
public WindowAggregateOperator(OpChainExecutionContext context, MultiStageOperator inputOperator, List<RexExpression> groupSet, List<RexExpression> orderSet, List<org.apache.calcite.rel.RelFieldCollation.Direction> orderSetDirection, List<org.apache.calcite.rel.RelFieldCollation.NullDirection> orderSetNullDirection, List<RexExpression> aggCalls, int lowerBound, int upperBound, WindowNode.WindowFrameType windowFrameType, List<RexExpression> constants, DataSchema resultSchema, DataSchema inputSchema)
-
WindowAggregateOperator
public WindowAggregateOperator(OpChainExecutionContext context, MultiStageOperator inputOperator, List<RexExpression> groupSet, List<RexExpression> orderSet, List<org.apache.calcite.rel.RelFieldCollation.Direction> orderSetDirection, List<org.apache.calcite.rel.RelFieldCollation.NullDirection> orderSetNullDirection, List<RexExpression> aggCalls, int lowerBound, int upperBound, WindowNode.WindowFrameType windowFrameType, List<RexExpression> constants, DataSchema resultSchema, DataSchema inputSchema, Map<String,Function<DataSchema.ColumnDataType,AggregationUtils.Merger>> mergers)
-
-
Method Detail
-
getChildOperators
public List<MultiStageOperator> getChildOperators()
- Specified by:
getChildOperatorsin interfaceOperator<TransferableBlock>- Overrides:
getChildOperatorsin classMultiStageOperator
-
toExplainString
@Nullable public String toExplainString()
-
getNextBlock
protected TransferableBlock getNextBlock()
- Specified by:
getNextBlockin classMultiStageOperator
-
-