Class BatchApproxCountDistinctAggFunctions.ApproxCountDistinctAggFunction<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<Long,HllBuffer>
-
- org.apache.flink.table.runtime.functions.aggregate.BatchApproxCountDistinctAggFunctions.ApproxCountDistinctAggFunction<T>
-
- All Implemented Interfaces:
Serializable
,FunctionDefinition
- Direct Known Subclasses:
BatchApproxCountDistinctAggFunctions.ByteApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.DateApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.DecimalApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.DoubleApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.FloatApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.IntApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.LongApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.ShortApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.StringApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.TimeApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.TimestampApproxCountDistinctAggFunction
,BatchApproxCountDistinctAggFunctions.TimestampLtzApproxCountDistinctAggFunction
- Enclosing class:
- BatchApproxCountDistinctAggFunctions
public abstract static class BatchApproxCountDistinctAggFunctions.ApproxCountDistinctAggFunction<T> extends BuiltInAggregateFunction<Long,HllBuffer>
Base function for APPROX_COUNT_DISTINCT aggregate.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ApproxCountDistinctAggFunction(LogicalType valueType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accumulate(HllBuffer buffer, Object input)
HllBuffer
createAccumulator()
Creates and initializes the accumulator for thisImperativeAggregateFunction
.DataType
getAccumulatorDataType()
List<DataType>
getArgumentDataTypes()
DataType
getOutputDataType()
Long
getValue(HllBuffer buffer)
Called every time when an aggregation result should be materialized.void
merge(HllBuffer buffer, Iterable<HllBuffer> it)
void
resetAccumulator(HllBuffer buffer)
-
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
-
ApproxCountDistinctAggFunction
public ApproxCountDistinctAggFunction(LogicalType valueType)
-
-
Method Detail
-
createAccumulator
public HllBuffer 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,HllBuffer>
- Returns:
- the accumulator with the initial value
-
accumulate
public void accumulate(HllBuffer buffer, Object input) throws Exception
- Throws:
Exception
-
merge
public void merge(HllBuffer buffer, Iterable<HllBuffer> it) throws Exception
- Throws:
Exception
-
resetAccumulator
public void resetAccumulator(HllBuffer buffer)
-
getValue
public Long getValue(HllBuffer buffer)
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,HllBuffer>
- Parameters:
buffer
- the accumulator which contains the current intermediate results- Returns:
- the aggregation result
-
getArgumentDataTypes
public List<DataType> getArgumentDataTypes()
- Overrides:
getArgumentDataTypes
in classBuiltInAggregateFunction<Long,HllBuffer>
-
getAccumulatorDataType
public DataType getAccumulatorDataType()
- Overrides:
getAccumulatorDataType
in classBuiltInAggregateFunction<Long,HllBuffer>
-
getOutputDataType
public DataType getOutputDataType()
- Overrides:
getOutputDataType
in classBuiltInAggregateFunction<Long,HllBuffer>
-
-