public class AggregateUtil$ extends Object
Modifier and Type | Field and Description |
---|---|
static AggregateUtil$ |
MODULE$
Static reference to the singleton instance of this Scala object.
|
Constructor and Description |
---|
AggregateUtil$() |
Modifier and Type | Method and Description |
---|---|
long |
asLong(Expression expr) |
scala.Tuple2<scala.Option<Object>,scala.Option<Object>> |
computeWindowStartEndPropertyPos(scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties) |
RowTypeInfo |
createAccumulatorRowType(AggregateFunction<?,?>[] aggregates) |
AllWindowFunction<Row,CRow,Window> |
createAggregationAllWindowFunction(LogicalWindow window,
int finalRowArity,
scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties)
Create an
AllWindowFunction for non-partitioned window aggregates. |
WindowFunction<Row,CRow,Tuple,Window> |
createAggregationGroupWindowFunction(LogicalWindow window,
int numGroupingKeys,
int numAggregates,
int finalRowArity,
scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties)
Create a
WindowFunction for group window aggregates. |
ProcessFunction<CRow,CRow> |
createBoundedOverProcessFunction(CodeGenerator generator,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType inputType,
TypeInformation<Row> inputTypeInfo,
scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo,
long precedingOffset,
StreamQueryConfig queryConfig,
boolean isRowsClause,
boolean isRowTimeType)
Create an
ProcessFunction for ROWS clause
bounded OVER window to evaluate final aggregate value. |
scala.Tuple3<scala.Option<DataSetPreAggFunction>,scala.Option<TypeInformation<Row>>,RichGroupReduceFunction<Row,Row>> |
createDataSetAggregateFunctions(CodeGenerator generator,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType inputType,
scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo,
org.apache.calcite.rel.type.RelDataType outputType,
int[] groupings,
boolean inGroupingSet)
Create functions to compute a
DataSetAggregate . |
FlatMapFunction<Row,Row> |
createDataSetSlideWindowPrepareFlatMapFunction(LogicalWindow window,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
int[] groupings,
TypeInformation<Row> inputType,
boolean isParserCaseSensitive)
Create a
FlatMapFunction that prepares for
non-incremental aggregates of sliding windows (time-windows). |
RichGroupReduceFunction<Row,Row> |
createDataSetSlideWindowPrepareGroupReduceFunction(CodeGenerator generator,
LogicalWindow window,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
int[] groupings,
org.apache.calcite.rel.type.RelDataType physicalInputRowType,
scala.collection.Seq<TypeInformation<?>> physicalInputTypes,
boolean isParserCaseSensitive)
Create a
GroupReduceFunction that prepares for
partial aggregates of sliding windows (time and count-windows). |
GroupCombineFunction<Row,Row> |
createDataSetWindowAggregationCombineFunction(CodeGenerator generator,
LogicalWindow window,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType physicalInputRowType,
scala.collection.Seq<TypeInformation<?>> physicalInputTypes,
int[] groupings)
Create a
GroupCombineFunction that pre-aggregation
for aggregates. |
RichGroupReduceFunction<Row,Row> |
createDataSetWindowAggregationGroupReduceFunction(CodeGenerator generator,
LogicalWindow window,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType physicalInputRowType,
scala.collection.Seq<TypeInformation<?>> physicalInputTypes,
org.apache.calcite.rel.type.RelDataType outputType,
int[] groupings,
scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties,
boolean isInputCombined)
Create a
GroupReduceFunction to compute window
aggregates on batch tables. |
MapPartitionFunction<Row,Row> |
createDataSetWindowAggregationMapPartitionFunction(CodeGenerator generator,
LogicalWindow window,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType physicalInputRowType,
scala.collection.Seq<TypeInformation<?>> physicalInputTypes,
int[] groupings)
Create a
MapPartitionFunction that aggregation
for aggregates. |
MapFunction<Row,Row> |
createDataSetWindowPrepareMapFunction(CodeGenerator generator,
LogicalWindow window,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
int[] groupings,
org.apache.calcite.rel.type.RelDataType inputType,
scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo,
boolean isParserCaseSensitive)
Create a
MapFunction that prepares for aggregates. |
scala.Tuple3<AggregateFunction<CRow,Row,Row>,RowTypeInfo,RowTypeInfo> |
createDataStreamAggregateFunction(CodeGenerator generator,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType inputType,
scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo,
org.apache.calcite.rel.type.RelDataType outputType,
int[] groupingKeys,
boolean needMerge) |
ProcessFunction<CRow,CRow> |
createGroupAggregateFunction(CodeGenerator generator,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType inputRowType,
scala.collection.Seq<TypeInformation<?>> inputFieldTypes,
int[] groupings,
StreamQueryConfig queryConfig,
boolean generateRetraction,
boolean consumeRetraction)
Create an
ProcessFunction for group (without
window) aggregate to evaluate final aggregate value. |
ProcessFunction<CRow,CRow> |
createUnboundedOverProcessFunction(CodeGenerator generator,
scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType inputType,
TypeInformation<Row> inputTypeInfo,
scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo,
StreamQueryConfig queryConfig,
boolean isRowTimeType,
boolean isPartitioned,
boolean isRowsClause)
Create an
ProcessFunction for unbounded OVER
window to evaluate final aggregate value. |
long |
determineLargestTumblingSize(long size,
long slide) |
boolean |
doAllSupportPartialMerge(AggregateFunction<?,?>[] aggregateList)
Return true if all aggregates can be partially merged.
|
boolean |
doAllSupportPartialMerge(scala.collection.Seq<org.apache.calcite.rel.core.AggregateCall> aggregateCalls,
org.apache.calcite.rel.type.RelDataType inputType,
int groupKeysCount)
Return true if all aggregates can be partially merged.
|
public static final AggregateUtil$ MODULE$
public ProcessFunction<CRow,CRow> createUnboundedOverProcessFunction(CodeGenerator generator, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType inputType, TypeInformation<Row> inputTypeInfo, scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo, StreamQueryConfig queryConfig, boolean isRowTimeType, boolean isPartitioned, boolean isRowsClause)
ProcessFunction
for unbounded OVER
window to evaluate final aggregate value.
generator
- code generator instancenamedAggregates
- Physical calls to aggregate functions and their output field namesinputType
- Physical type of the row.inputTypeInfo
- Physical type information of the row.inputFieldTypeInfo
- Physical type information of the row's fields.isRowTimeType
- It is a tag that indicates whether the time type is rowTimeTypeisPartitioned
- It is a tag that indicate whether the input is partitionedisRowsClause
- It is a tag that indicates whether the OVER clause is ROWS clausequeryConfig
- (undocumented)public ProcessFunction<CRow,CRow> createGroupAggregateFunction(CodeGenerator generator, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType inputRowType, scala.collection.Seq<TypeInformation<?>> inputFieldTypes, int[] groupings, StreamQueryConfig queryConfig, boolean generateRetraction, boolean consumeRetraction)
ProcessFunction
for group (without
window) aggregate to evaluate final aggregate value.
generator
- code generator instancenamedAggregates
- List of calls to aggregate functions and their output field namesinputRowType
- Input row typeinputFieldTypes
- Types of the physical input fieldsgroupings
- the position (in the input Row) of the grouping keysqueryConfig
- The configuration of the query to generate.generateRetraction
- It is a tag that indicates whether generate retract record.consumeRetraction
- It is a tag that indicates whether consume the retract record.ProcessFunction
public ProcessFunction<CRow,CRow> createBoundedOverProcessFunction(CodeGenerator generator, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType inputType, TypeInformation<Row> inputTypeInfo, scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo, long precedingOffset, StreamQueryConfig queryConfig, boolean isRowsClause, boolean isRowTimeType)
ProcessFunction
for ROWS clause
bounded OVER window to evaluate final aggregate value.
generator
- code generator instancenamedAggregates
- Physical calls to aggregate functions and their output field namesinputType
- Physical type of the row.inputTypeInfo
- Physical type information of the row.inputFieldTypeInfo
- Physical type information of the row's fields.precedingOffset
- the preceding offsetisRowsClause
- It is a tag that indicates whether the OVER clause is ROWS clauseisRowTimeType
- It is a tag that indicates whether the time type is rowTimeTypequeryConfig
- (undocumented)ProcessFunction
public MapFunction<Row,Row> createDataSetWindowPrepareMapFunction(CodeGenerator generator, LogicalWindow window, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, int[] groupings, org.apache.calcite.rel.type.RelDataType inputType, scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo, boolean isParserCaseSensitive)
MapFunction
that prepares for aggregates.
The output of the function contains the grouping keys and the timestamp and the intermediate
aggregate values of all aggregate function. The timestamp field is aligned to time window
start and used to be a grouping key in case of time window. In case of count window on
event-time, the timestamp is not aligned and used to sort.
The output is stored in Row by the following format:
avg(x) count(z)
| |
v v
+---------+---------+----------------+----------------+------------------+-------+
|groupKey1|groupKey2| AvgAccumulator | SumAccumulator | CountAccumulator |rowtime|
+---------+---------+----------------+----------------+------------------+-------+
^ ^
| |
sum(y) rowtime to group or sort
NOTE: this function is only used for time based window on batch tables.
generator
- (undocumented)window
- (undocumented)namedAggregates
- (undocumented)groupings
- (undocumented)inputType
- (undocumented)inputFieldTypeInfo
- (undocumented)isParserCaseSensitive
- (undocumented)public RichGroupReduceFunction<Row,Row> createDataSetSlideWindowPrepareGroupReduceFunction(CodeGenerator generator, LogicalWindow window, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, int[] groupings, org.apache.calcite.rel.type.RelDataType physicalInputRowType, scala.collection.Seq<TypeInformation<?>> physicalInputTypes, boolean isParserCaseSensitive)
GroupReduceFunction
that prepares for
partial aggregates of sliding windows (time and count-windows).
It requires a prepared input (with intermediate aggregate fields and aligned rowtime for
pre-tumbling in case of time-windows), pre-aggregates (pre-tumbles) rows, aligns the
window-start, and replicates or omits records for different panes of a sliding window.
The output of the function contains the grouping keys, the intermediate aggregate values of all aggregate function and the aligned window start. Window start must not be a timestamp, but can also be a count value for count-windows.
The output is stored in Row by the following format:
avg(x) aggOffsetInRow = 2 count(z) aggOffsetInRow = 5
| |
v v
+---------+---------+--------+--------+--------+--------+-------------+
|groupKey1|groupKey2| sum1 | count1 | sum2 | count2 | windowStart |
+---------+---------+--------+--------+--------+--------+-------------+
^ ^
| |
sum(y) aggOffsetInRow = 4 window start for pane mapping
NOTE: this function is only used for sliding windows with partial aggregates on batch tables.
generator
- (undocumented)window
- (undocumented)namedAggregates
- (undocumented)groupings
- (undocumented)physicalInputRowType
- (undocumented)physicalInputTypes
- (undocumented)isParserCaseSensitive
- (undocumented)public FlatMapFunction<Row,Row> createDataSetSlideWindowPrepareFlatMapFunction(LogicalWindow window, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, int[] groupings, TypeInformation<Row> inputType, boolean isParserCaseSensitive)
FlatMapFunction
that prepares for
non-incremental aggregates of sliding windows (time-windows).
It requires a prepared input (with intermediate aggregate fields), aligns the window-start, and replicates or omits records for different panes of a sliding window.
The output of the function contains the grouping keys, the intermediate aggregate values of all aggregate function and the aligned window start.
The output is stored in Row by the following format:
avg(x) aggOffsetInRow = 2 count(z) aggOffsetInRow = 5
| |
v v
+---------+---------+--------+--------+--------+--------+-------------+
|groupKey1|groupKey2| sum1 | count1 | sum2 | count2 | windowStart |
+---------+---------+--------+--------+--------+--------+-------------+
^ ^
| |
sum(y) aggOffsetInRow = 4 window start for pane mapping
NOTE: this function is only used for time-based sliding windows on batch tables.
window
- (undocumented)namedAggregates
- (undocumented)groupings
- (undocumented)inputType
- (undocumented)isParserCaseSensitive
- (undocumented)public RichGroupReduceFunction<Row,Row> createDataSetWindowAggregationGroupReduceFunction(CodeGenerator generator, LogicalWindow window, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType physicalInputRowType, scala.collection.Seq<TypeInformation<?>> physicalInputTypes, org.apache.calcite.rel.type.RelDataType outputType, int[] groupings, scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties, boolean isInputCombined)
GroupReduceFunction
to compute window
aggregates on batch tables. If all aggregates support partial aggregation and is a time
window, the GroupReduceFunction
implements
CombineFunction
as well.
NOTE: this function is only used for window on batch tables.
generator
- (undocumented)window
- (undocumented)namedAggregates
- (undocumented)physicalInputRowType
- (undocumented)physicalInputTypes
- (undocumented)outputType
- (undocumented)groupings
- (undocumented)properties
- (undocumented)isInputCombined
- (undocumented)public MapPartitionFunction<Row,Row> createDataSetWindowAggregationMapPartitionFunction(CodeGenerator generator, LogicalWindow window, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType physicalInputRowType, scala.collection.Seq<TypeInformation<?>> physicalInputTypes, int[] groupings)
MapPartitionFunction
that aggregation
for aggregates.
The function returns aggregate values of all aggregate function which are
organized by the following format:
avg(x) aggOffsetInRow = 2 count(z) aggOffsetInRow = 5
| | windowEnd(max(rowtime)
| | |
v v v
+--------+--------+--------+--------+-----------+---------+
| sum1 | count1 | sum2 | count2 |windowStart|windowEnd|
+--------+--------+--------+--------+-----------+---------+
^ ^
| |
sum(y) aggOffsetInRow = 4 windowStart(min(rowtime))
generator
- (undocumented)window
- (undocumented)namedAggregates
- (undocumented)physicalInputRowType
- (undocumented)physicalInputTypes
- (undocumented)groupings
- (undocumented)public GroupCombineFunction<Row,Row> createDataSetWindowAggregationCombineFunction(CodeGenerator generator, LogicalWindow window, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType physicalInputRowType, scala.collection.Seq<TypeInformation<?>> physicalInputTypes, int[] groupings)
GroupCombineFunction
that pre-aggregation
for aggregates.
The function returns intermediate aggregate values of all aggregate function which are
organized by the following format:
avg(x) windowEnd(max(rowtime)
| |
v v
+---------+---------+----------------+----------------+-------------+-----------+
|groupKey1|groupKey2| AvgAccumulator | SumAccumulator | windowStart | windowEnd |
+---------+---------+----------------+----------------+-------------+-----------+
^ ^
| |
sum(y) windowStart(min(rowtime))
generator
- (undocumented)window
- (undocumented)namedAggregates
- (undocumented)physicalInputRowType
- (undocumented)physicalInputTypes
- (undocumented)groupings
- (undocumented)public scala.Tuple3<scala.Option<DataSetPreAggFunction>,scala.Option<TypeInformation<Row>>,RichGroupReduceFunction<Row,Row>> createDataSetAggregateFunctions(CodeGenerator generator, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType inputType, scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo, org.apache.calcite.rel.type.RelDataType outputType, int[] groupings, boolean inGroupingSet)
DataSetAggregate
.
If all aggregation functions support pre-aggregation, a pre-aggregation function and the
respective output type are generated as well.generator
- (undocumented)namedAggregates
- (undocumented)inputType
- (undocumented)inputFieldTypeInfo
- (undocumented)outputType
- (undocumented)groupings
- (undocumented)inGroupingSet
- (undocumented)public AllWindowFunction<Row,CRow,Window> createAggregationAllWindowFunction(LogicalWindow window, int finalRowArity, scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties)
AllWindowFunction
for non-partitioned window aggregates.window
- (undocumented)finalRowArity
- (undocumented)properties
- (undocumented)public WindowFunction<Row,CRow,Tuple,Window> createAggregationGroupWindowFunction(LogicalWindow window, int numGroupingKeys, int numAggregates, int finalRowArity, scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties)
WindowFunction
for group window aggregates.window
- (undocumented)numGroupingKeys
- (undocumented)numAggregates
- (undocumented)finalRowArity
- (undocumented)properties
- (undocumented)public scala.Tuple3<AggregateFunction<CRow,Row,Row>,RowTypeInfo,RowTypeInfo> createDataStreamAggregateFunction(CodeGenerator generator, scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType inputType, scala.collection.Seq<TypeInformation<?>> inputFieldTypeInfo, org.apache.calcite.rel.type.RelDataType outputType, int[] groupingKeys, boolean needMerge)
public boolean doAllSupportPartialMerge(scala.collection.Seq<org.apache.calcite.rel.core.AggregateCall> aggregateCalls, org.apache.calcite.rel.type.RelDataType inputType, int groupKeysCount)
aggregateCalls
- (undocumented)inputType
- (undocumented)groupKeysCount
- (undocumented)public boolean doAllSupportPartialMerge(AggregateFunction<?,?>[] aggregateList)
aggregateList
- (undocumented)public scala.Tuple2<scala.Option<Object>,scala.Option<Object>> computeWindowStartEndPropertyPos(scala.collection.Seq<FlinkRelBuilder.NamedWindowProperty> properties)
public RowTypeInfo createAccumulatorRowType(AggregateFunction<?,?>[] aggregates)
public long asLong(Expression expr)
public long determineLargestTumblingSize(long size, long slide)
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.