public interface AggImplementor
StrictAggImplementor,
StrictWinAggImplementor,
RexImpTable.CountImplementor,
RexImpTable.SumImplementor| Modifier and Type | Method and Description |
|---|---|
List<Type> |
getStateType(AggContext info)
Returns the types of the intermediate variables used by the aggregate
implementation.
|
void |
implementAdd(AggContext info,
AggAddContext add)
Updates intermediate values to account for the newly added value.
|
void |
implementReset(AggContext info,
AggResetContext reset)
Implements reset of the intermediate variables to the initial state.
|
Expression |
implementResult(AggContext info,
AggResultContext result)
Calculates the resulting value based on the intermediate variables.
|
List<Type> getStateType(AggContext info)
For instance, for "concatenate to string" this can be
StringBuilder.
Calcite calls this method before all other implement* methods.
info - Aggregate contextvoid implementReset(AggContext info, AggResetContext reset)
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)));info - Aggregate contextreset - Reset contextvoid implementAdd(AggContext info, AggAddContext add)
AggResetContext.accumulator() should be used to reference
the state variables.info - Aggregate contextadd - Add contextExpression implementResult(AggContext info, AggResultContext result)
AggResetContext.accumulator() should be used to reference
the state variables.info - Aggregate contextresult - Result contextCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.