Class FirstValueAggFunction<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<T,RowData>
-
- org.apache.flink.table.runtime.functions.aggregate.FirstValueAggFunction<T>
-
- All Implemented Interfaces:
Serializable
,FunctionDefinition
@Internal public final class FirstValueAggFunction<T> extends BuiltInAggregateFunction<T,RowData>
Built-in FIRST_VALUE aggregate function.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FirstValueAggFunction(LogicalType valueType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accumulate(RowData rowData, Object value)
void
accumulate(RowData rowData, Object value, Long order)
void
accumulate(RowData rowData, StringData value)
void
accumulate(RowData rowData, StringData value, Long order)
RowData
createAccumulator()
Creates and initializes the accumulator for thisImperativeAggregateFunction
.DataType
getAccumulatorDataType()
List<DataType>
getArgumentDataTypes()
DataType
getOutputDataType()
T
getValue(RowData acc)
Called every time when an aggregation result should be materialized.boolean
isDeterministic()
Returns information about the determinism of the function's results.void
resetAccumulator(RowData rowData)
-
Methods inherited from class org.apache.flink.table.runtime.functions.aggregate.BuiltInAggregateFunction
getRequirements, getTypeInference
-
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
-
FirstValueAggFunction
public FirstValueAggFunction(LogicalType valueType)
-
-
Method Detail
-
getArgumentDataTypes
public List<DataType> getArgumentDataTypes()
- Overrides:
getArgumentDataTypes
in classBuiltInAggregateFunction<T,RowData>
-
getAccumulatorDataType
public DataType getAccumulatorDataType()
- Overrides:
getAccumulatorDataType
in classBuiltInAggregateFunction<T,RowData>
-
getOutputDataType
public DataType getOutputDataType()
- Overrides:
getOutputDataType
in classBuiltInAggregateFunction<T,RowData>
-
isDeterministic
public boolean isDeterministic()
Description copied from interface:FunctionDefinition
Returns information about the determinism of the function's results.It returns
true
if and only if a call to this function is guaranteed to always return the same result given the same parameters.true
is assumed by default. If the function is not purely functional likerandom(), date(), now(), ...
this method must returnfalse
.Furthermore, return
false
if the planner should always execute this function on the cluster side. In other words: the planner should not perform constant expression reduction during planning for constant calls to this function.- Specified by:
isDeterministic
in interfaceFunctionDefinition
- Overrides:
isDeterministic
in classBuiltInAggregateFunction<T,RowData>
-
createAccumulator
public RowData 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<T,RowData>
- Returns:
- the accumulator with the initial value
-
accumulate
public void accumulate(RowData rowData, StringData value)
-
accumulate
public void accumulate(RowData rowData, StringData value, Long order)
-
resetAccumulator
public void resetAccumulator(RowData rowData)
-
getValue
public T getValue(RowData 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<T,RowData>
- Parameters:
acc
- the accumulator which contains the current intermediate results- Returns:
- the aggregation result
-
-