Package org.apache.flink.table.toolbox
Class CountAggFunction
- java.lang.Object
-
- org.apache.flink.table.functions.UserDefinedFunction
-
- org.apache.flink.table.functions.ImperativeAggregateFunction<T,ACC>
-
- org.apache.flink.table.functions.AggregateFunction<Long,CountAggFunction.CountAccumulator>
-
- org.apache.flink.table.toolbox.CountAggFunction
-
- All Implemented Interfaces:
Serializable
,FunctionDefinition
public class CountAggFunction extends AggregateFunction<Long,CountAggFunction.CountAccumulator>
Count agg aggregate.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CountAggFunction.CountAccumulator
The initial accumulator for count aggregate function.
-
Constructor Summary
Constructors Constructor Description CountAggFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accumulate(CountAggFunction.CountAccumulator acc)
void
accumulate(CountAggFunction.CountAccumulator acc, Long value)
CountAggFunction.CountAccumulator
createAccumulator()
Creates and initializes the accumulator for thisImperativeAggregateFunction
.Long
getValue(CountAggFunction.CountAccumulator acc)
Called every time when an aggregation result should be materialized.void
merge(CountAggFunction.CountAccumulator acc, Iterable<CountAggFunction.CountAccumulator> its)
void
retract(CountAggFunction.CountAccumulator acc)
void
retract(CountAggFunction.CountAccumulator acc, Long value)
-
Methods inherited from class org.apache.flink.table.functions.AggregateFunction
getKind, getTypeInference
-
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
getRequirements, isDeterministic, supportsConstantFolding
-
-
-
-
Method Detail
-
accumulate
public void accumulate(CountAggFunction.CountAccumulator acc, Long value)
-
accumulate
public void accumulate(CountAggFunction.CountAccumulator acc)
-
retract
public void retract(CountAggFunction.CountAccumulator acc, Long value)
-
retract
public void retract(CountAggFunction.CountAccumulator acc)
-
getValue
public Long getValue(CountAggFunction.CountAccumulator 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<Long,CountAggFunction.CountAccumulator>
- Parameters:
acc
- the accumulator which contains the current intermediate results- Returns:
- the aggregation result
-
merge
public void merge(CountAggFunction.CountAccumulator acc, Iterable<CountAggFunction.CountAccumulator> its)
-
createAccumulator
public CountAggFunction.CountAccumulator 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<Long,CountAggFunction.CountAccumulator>
- Returns:
- the accumulator with the initial value
-
-