public class AggregateUtil extends Object
Constructor and Description |
---|
AggregateUtil() |
Modifier and Type | Method and Description |
---|---|
static scala.Tuple2<MapFunction<Object,Row>,GroupReduceFunction<Row,Row>> |
createOperatorFunctionsForAggregates(scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates,
org.apache.calcite.rel.type.RelDataType inputType,
org.apache.calcite.rel.type.RelDataType outputType,
int[] groupings,
TableConfig config)
Create Flink operator functions for aggregates.
|
public static scala.Tuple2<MapFunction<Object,Row>,GroupReduceFunction<Row,Row>> createOperatorFunctionsForAggregates(scala.collection.Seq<org.apache.calcite.util.Pair<org.apache.calcite.rel.core.AggregateCall,String>> namedAggregates, org.apache.calcite.rel.type.RelDataType inputType, org.apache.calcite.rel.type.RelDataType outputType, int[] groupings, TableConfig config)
MapFunction
and
GroupReduceFunction
(if it's partial aggregate,
should also implement CombineFunction
as well).
The output of MapFunction
contains the
intermediate aggregate values of all aggregate function, it's stored in Row by the following
format:
avg(x) aggOffsetInRow = 2 count(z) aggOffsetInRow = 5
| |
v v
+---------+---------+--------+--------+--------+--------+
|groupKey1|groupKey2| sum1 | count1 | sum2 | count2 |
+---------+---------+--------+--------+--------+--------+
^
|
sum(y) aggOffsetInRow = 4
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.