Class StrictAggImplementor
java.lang.Object
org.apache.calcite.adapter.enumerable.StrictAggImplementor
- All Implemented Interfaces:
AggImplementor
- Direct Known Subclasses:
RexImpTable.UserDefinedAggReflectiveImplementor,StrictWinAggImplementor
The base implementation of strict aggregate function.
- See Also:
-
RexImpTable.CountImplementorRexImpTable.SumImplementor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaccAdvance(AggAddContext add, Expression acc, Expression next) getNotNullState(AggContext info) protected final intgetStateType(AggContext info) Returns the types of the intermediate variables used by the aggregate implementation.final voidimplementAdd(AggContext info, AggAddContext add) Updates intermediate values to account for the newly added value.protected abstract voidimplementNotNullAdd(AggContext info, AggAddContext add) protected voidimplementNotNullReset(AggContext info, AggResetContext reset) protected ExpressionimplementNotNullResult(AggContext info, AggResultContext result) final voidimplementReset(AggContext info, AggResetContext reset) Implements reset of the intermediate variables to the initial state.final ExpressionimplementResult(AggContext info, AggResultContext result) Calculates the resulting value based on the intermediate variables.protected boolean
-
Constructor Details
-
StrictAggImplementor
public StrictAggImplementor()
-
-
Method Details
-
nonDefaultOnEmptySet
-
getStateSize
protected final int getStateSize() -
accAdvance
-
getStateType
Description copied from interface:AggImplementorReturns the types of the intermediate variables used by the aggregate implementation.For instance, for "concatenate to string" this can be
StringBuilder. Calcite calls this method before all otherimplement*methods.- Specified by:
getStateTypein interfaceAggImplementor- Parameters:
info- Aggregate context- Returns:
- Types of the intermediate variables used by the aggregate implementation
-
getNotNullState
-
implementReset
Description copied from interface:AggImplementorImplements reset of the intermediate variables to the initial state.AggResetContext.accumulator()should be used to reference the state variables. For instance, to zero the count, use the following code:reset.currentBlock().add(
Expressions.statement(
Expressions.assign(reset.accumulator().get(0),
Expressions.constant(0)));- Specified by:
implementResetin interfaceAggImplementor- Parameters:
info- Aggregate contextreset- Reset context
-
implementNotNullReset
-
implementAdd
Description copied from interface:AggImplementorUpdates intermediate values to account for the newly added value.AggResetContext.accumulator()should be used to reference the state variables.- Specified by:
implementAddin interfaceAggImplementor- Parameters:
info- Aggregate contextadd- Add context
-
implementNotNullAdd
-
implementResult
Description copied from interface:AggImplementorCalculates the resulting value based on the intermediate variables. Note: this method must NOT destroy the intermediate variables as calcite might reuse the state when calculating sliding aggregates.AggResetContext.accumulator()should be used to reference the state variables.- Specified by:
implementResultin interfaceAggImplementor- Parameters:
info- Aggregate contextresult- Result context- Returns:
- Expression that is a result of calculating final value of the aggregate being implemented
-
implementNotNullResult
-