public class AggregateFunctionImpl extends Object implements AggregateFunction, ImplementableAggFunction
AggregateFunction via user-defined class.
The class should implement A init(), A add(A, V), and
R result(A) methods.
All the methods should be either static or instance.
Bonus point: when using non-static implementation, the aggregate object is
reused through the calculation, thus it can have aggregation-related state.| Modifier and Type | Field and Description |
|---|---|
Class<?> |
accumulatorType |
Method |
addMethod |
Class<?> |
declaringClass |
Method |
initMethod |
boolean |
isStatic |
Method |
mergeMethod |
private List<FunctionParameter> |
parameters |
Method |
resultMethod |
Class<?> |
resultType |
com.google.common.collect.ImmutableList<Class<?>> |
valueTypes |
| Modifier | Constructor and Description |
|---|---|
private |
AggregateFunctionImpl(Class<?> declaringClass,
List<FunctionParameter> params,
List<Class<?>> valueTypes,
Class<?> accumulatorType,
Class<?> resultType,
Method initMethod,
Method addMethod,
Method mergeMethod,
Method resultMethod)
Private constructor; use
create(java.lang.Class<?>). |
| Modifier and Type | Method and Description |
|---|---|
static AggregateFunctionImpl |
create(Class<?> clazz)
Creates an aggregate function, or returns null.
|
AggImplementor |
getImplementor(boolean windowContext)
Returns implementor that translates the function to linq4j expression.
|
List<FunctionParameter> |
getParameters()
Returns the parameters of this function.
|
RelDataType |
getReturnType(RelDataTypeFactory typeFactory)
Returns the return type of this function, constructed using the given
type factory.
|
public final boolean isStatic
public final Method initMethod
public final Method addMethod
public final Method mergeMethod
public final Method resultMethod
public final com.google.common.collect.ImmutableList<Class<?>> valueTypes
private final List<FunctionParameter> parameters
public final Class<?> accumulatorType
public final Class<?> resultType
public final Class<?> declaringClass
private AggregateFunctionImpl(Class<?> declaringClass, List<FunctionParameter> params, List<Class<?>> valueTypes, Class<?> accumulatorType, Class<?> resultType, Method initMethod, Method addMethod, Method mergeMethod, Method resultMethod)
create(java.lang.Class<?>).public static AggregateFunctionImpl create(Class<?> clazz)
public List<FunctionParameter> getParameters()
FunctiongetParameters in interface Functionpublic RelDataType getReturnType(RelDataTypeFactory typeFactory)
AggregateFunctiongetReturnType in interface AggregateFunctiontypeFactory - Type factorypublic AggImplementor getImplementor(boolean windowContext)
ImplementableAggFunctiongetImplementor in interface ImplementableAggFunctionwindowContext - true when aggregate is used in window contextCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.