public static class RexImpTable.LagImplementor extends Object
LAG windowed aggregate function.WinAggImplementor.SeekType| Modifier | Constructor and Description |
|---|---|
protected |
RexImpTable.LagImplementor() |
| 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.
|
boolean |
needCacheWhenFrameIntact() |
public List<Type> getStateType(AggContext info)
AggImplementorFor instance, for "concatenate to string" this can be
StringBuilder.
Calcite calls this method before all other implement* methods.
getStateType in interface AggImplementorinfo - Aggregate contextpublic void implementReset(AggContext info, AggResetContext reset)
AggImplementorAggResetContext.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)));implementReset in interface AggImplementorinfo - Aggregate contextreset - Reset contextpublic void implementAdd(AggContext info, AggAddContext add)
AggImplementorAggResetContext.accumulator() should be used to reference
the state variables.implementAdd in interface AggImplementorinfo - Aggregate contextadd - Add contextpublic boolean needCacheWhenFrameIntact()
needCacheWhenFrameIntact in interface WinAggImplementorpublic Expression implementResult(AggContext info, AggResultContext result)
AggImplementorAggResetContext.accumulator() should be used to reference
the state variables.implementResult in interface AggImplementorinfo - Aggregate contextresult - Result contextCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.