Package org.apache.calcite.schema.impl
Class AggregateFunctionImpl
- java.lang.Object
-
- org.apache.calcite.schema.impl.AggregateFunctionImpl
-
- All Implemented Interfaces:
AggregateFunction
,Function
,ImplementableAggFunction
public class AggregateFunctionImpl extends java.lang.Object implements AggregateFunction, ImplementableAggFunction
Implementation ofAggregateFunction
via user-defined class. The class should implementA init()
,A add(A, V)
, andR 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.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Class<?>
accumulatorType
java.lang.reflect.Method
addMethod
java.lang.Class<?>
declaringClass
java.lang.reflect.Method
initMethod
boolean
isStatic
java.lang.reflect.Method
mergeMethod
private java.util.List<FunctionParameter>
parameters
java.lang.reflect.Method
resultMethod
java.lang.Class<?>
resultType
com.google.common.collect.ImmutableList<java.lang.Class<?>>
valueTypes
-
Constructor Summary
Constructors Modifier Constructor Description private
AggregateFunctionImpl(java.lang.Class<?> declaringClass, java.util.List<FunctionParameter> params, java.util.List<java.lang.Class<?>> valueTypes, java.lang.Class<?> accumulatorType, java.lang.Class<?> resultType, java.lang.reflect.Method initMethod, java.lang.reflect.Method addMethod, java.lang.reflect.Method mergeMethod, java.lang.reflect.Method resultMethod)
Private constructor; usecreate(java.lang.Class<?>)
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AggregateFunctionImpl
create(java.lang.Class<?> clazz)
Creates an aggregate function, or returns null.AggImplementor
getImplementor(boolean windowContext)
Returns implementor that translates the function to linq4j expression.java.util.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.
-
-
-
Field Detail
-
isStatic
public final boolean isStatic
-
initMethod
public final java.lang.reflect.Method initMethod
-
addMethod
public final java.lang.reflect.Method addMethod
-
mergeMethod
public final java.lang.reflect.Method mergeMethod
-
resultMethod
public final java.lang.reflect.Method resultMethod
-
valueTypes
public final com.google.common.collect.ImmutableList<java.lang.Class<?>> valueTypes
-
parameters
private final java.util.List<FunctionParameter> parameters
-
accumulatorType
public final java.lang.Class<?> accumulatorType
-
resultType
public final java.lang.Class<?> resultType
-
declaringClass
public final java.lang.Class<?> declaringClass
-
-
Constructor Detail
-
AggregateFunctionImpl
private AggregateFunctionImpl(java.lang.Class<?> declaringClass, java.util.List<FunctionParameter> params, java.util.List<java.lang.Class<?>> valueTypes, java.lang.Class<?> accumulatorType, java.lang.Class<?> resultType, java.lang.reflect.Method initMethod, java.lang.reflect.Method addMethod, java.lang.reflect.Method mergeMethod, java.lang.reflect.Method resultMethod)
Private constructor; usecreate(java.lang.Class<?>)
.
-
-
Method Detail
-
create
public static AggregateFunctionImpl create(java.lang.Class<?> clazz)
Creates an aggregate function, or returns null.
-
getParameters
public java.util.List<FunctionParameter> getParameters()
Description copied from interface:Function
Returns the parameters of this function.- Specified by:
getParameters
in interfaceFunction
- Returns:
- Parameters; never null
-
getReturnType
public RelDataType getReturnType(RelDataTypeFactory typeFactory)
Description copied from interface:AggregateFunction
Returns the return type of this function, constructed using the given type factory.- Specified by:
getReturnType
in interfaceAggregateFunction
- Parameters:
typeFactory
- Type factory
-
getImplementor
public AggImplementor getImplementor(boolean windowContext)
Description copied from interface:ImplementableAggFunction
Returns implementor that translates the function to linq4j expression.- Specified by:
getImplementor
in interfaceImplementableAggFunction
- Parameters:
windowContext
- true when aggregate is used in window context- Returns:
- implementor that translates the function to linq4j expression.
-
-