Class ArrayAggFunction<T>
- java.lang.Object
-
- org.apache.flink.table.functions.UserDefinedFunction
-
- org.apache.flink.table.functions.ImperativeAggregateFunction<T,ACC>
-
- org.apache.flink.table.functions.AggregateFunction<T,ACC>
-
- org.apache.flink.table.runtime.functions.aggregate.BuiltInAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
-
- org.apache.flink.table.runtime.functions.aggregate.ArrayAggFunction<T>
-
- All Implemented Interfaces:
Serializable
,FunctionDefinition
@Internal public final class ArrayAggFunction<T> extends BuiltInAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
Built-in ARRAY_AGG aggregate function.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArrayAggFunction.ArrayAggAccumulator<T>
Accumulator for ARRAY_AGG with retraction.
-
Constructor Summary
Constructors Constructor Description ArrayAggFunction(LogicalType elementType, boolean ignoreNulls)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accumulate(ArrayAggFunction.ArrayAggAccumulator<T> acc, T value)
ArrayAggFunction.ArrayAggAccumulator<T>
createAccumulator()
Creates and initializes the accumulator for thisImperativeAggregateFunction
.DataType
getAccumulatorDataType()
List<DataType>
getArgumentDataTypes()
DataType
getOutputDataType()
ArrayData
getValue(ArrayAggFunction.ArrayAggAccumulator<T> acc)
Called every time when an aggregation result should be materialized.void
merge(ArrayAggFunction.ArrayAggAccumulator<T> acc, Iterable<ArrayAggFunction.ArrayAggAccumulator<T>> its)
void
resetAccumulator(ArrayAggFunction.ArrayAggAccumulator<T> acc)
void
retract(ArrayAggFunction.ArrayAggAccumulator<T> acc, T value)
-
Methods inherited from class org.apache.flink.table.runtime.functions.aggregate.BuiltInAggregateFunction
getRequirements, getTypeInference, isDeterministic
-
Methods inherited from class org.apache.flink.table.functions.AggregateFunction
getKind
-
Methods inherited from class org.apache.flink.table.functions.ImperativeAggregateFunction
getAccumulatorType, getResultType
-
Methods inherited from class org.apache.flink.table.functions.UserDefinedFunction
close, functionIdentifier, open, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.table.functions.FunctionDefinition
supportsConstantFolding
-
-
-
-
Constructor Detail
-
ArrayAggFunction
public ArrayAggFunction(LogicalType elementType, boolean ignoreNulls)
-
-
Method Detail
-
getArgumentDataTypes
public List<DataType> getArgumentDataTypes()
- Overrides:
getArgumentDataTypes
in classBuiltInAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
-
getAccumulatorDataType
public DataType getAccumulatorDataType()
- Overrides:
getAccumulatorDataType
in classBuiltInAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
-
getOutputDataType
public DataType getOutputDataType()
- Overrides:
getOutputDataType
in classBuiltInAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
-
createAccumulator
public ArrayAggFunction.ArrayAggAccumulator<T> createAccumulator()
Description copied from class:ImperativeAggregateFunction
Creates and initializes the accumulator for thisImperativeAggregateFunction
.The accumulator is an intermediate data structure that stores the aggregated values until a final aggregation result is computed.
- Specified by:
createAccumulator
in classImperativeAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
- Returns:
- the accumulator with the initial value
-
accumulate
public void accumulate(ArrayAggFunction.ArrayAggAccumulator<T> acc, T value) throws Exception
- Throws:
Exception
-
retract
public void retract(ArrayAggFunction.ArrayAggAccumulator<T> acc, T value) throws Exception
- Throws:
Exception
-
merge
public void merge(ArrayAggFunction.ArrayAggAccumulator<T> acc, Iterable<ArrayAggFunction.ArrayAggAccumulator<T>> its) throws Exception
- Throws:
Exception
-
getValue
public ArrayData getValue(ArrayAggFunction.ArrayAggAccumulator<T> acc)
Description copied from class:AggregateFunction
Called every time when an aggregation result should be materialized. The returned value could be either an early and incomplete result (periodically emitted as data arrives) or the final result of the aggregation.- Specified by:
getValue
in classAggregateFunction<ArrayData,ArrayAggFunction.ArrayAggAccumulator<T>>
- Parameters:
acc
- the accumulator which contains the current intermediate results- Returns:
- the aggregation result
-
resetAccumulator
public void resetAccumulator(ArrayAggFunction.ArrayAggAccumulator<T> acc)
-
-