Interface AggsHandleFunctionBase
-
- All Superinterfaces:
Function
,Serializable
- All Known Subinterfaces:
AggsHandleFunction
,TableAggsHandleFunction
public interface AggsHandleFunctionBase extends Function
The base class for handling aggregate or table aggregate functions.It is code generated to handle all
AggregateFunction
s andTableAggregateFunction
s together in an aggregation.It is the entry point for aggregate operators to operate all
AggregateFunction
s andTableAggregateFunction
s.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accumulate(RowData input)
Accumulates the input values to the accumulators.void
cleanup()
Cleanup for the retired accumulators state.void
close()
Tear-down method for this function.RowData
createAccumulators()
Initializes the accumulators and save them to a accumulators row.RowData
getAccumulators()
Gets the current accumulators (saved in a row) which contains the current aggregated results.void
merge(RowData accumulators)
Merges the other accumulators into current accumulators.void
open(StateDataViewStore store)
Initialization method for the function.void
resetAccumulators()
Resets all the accumulators.void
retract(RowData input)
Retracts the input values from the accumulators.void
setAccumulators(RowData accumulators)
Set the current accumulators (saved in a row) which contains the current aggregated results.
-
-
-
Method Detail
-
open
void open(StateDataViewStore store) throws Exception
Initialization method for the function. It is called before the actual working methods.- Throws:
Exception
-
accumulate
void accumulate(RowData input) throws Exception
Accumulates the input values to the accumulators.- Parameters:
input
- input values bundled in a row- Throws:
Exception
-
retract
void retract(RowData input) throws Exception
Retracts the input values from the accumulators.- Parameters:
input
- input values bundled in a row- Throws:
Exception
-
merge
void merge(RowData accumulators) throws Exception
Merges the other accumulators into current accumulators.- Parameters:
accumulators
- The other row of accumulators- Throws:
Exception
-
setAccumulators
void setAccumulators(RowData accumulators) throws Exception
Set the current accumulators (saved in a row) which contains the current aggregated results. In streaming: accumulators are store in the state, we need to restore aggregate buffers from state. In batch: accumulators are store in the hashMap, we need to restore aggregate buffers from hashMap.- Parameters:
accumulators
- current accumulators- Throws:
Exception
-
resetAccumulators
void resetAccumulators() throws Exception
Resets all the accumulators.- Throws:
Exception
-
getAccumulators
RowData getAccumulators() throws Exception
Gets the current accumulators (saved in a row) which contains the current aggregated results.- Returns:
- the current accumulators
- Throws:
Exception
-
createAccumulators
RowData createAccumulators() throws Exception
Initializes the accumulators and save them to a accumulators row.- Returns:
- a row of accumulators which contains the aggregated results
- Throws:
Exception
-
cleanup
void cleanup() throws Exception
Cleanup for the retired accumulators state.- Throws:
Exception
-
-