Class AggregateFunctionImpl

  • All Implemented Interfaces:
    AggregateFunction, Function, ImplementableAggFunction

    public class AggregateFunctionImpl
    extends java.lang.Object
    implements AggregateFunction, ImplementableAggFunction
    Implementation of 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.
    • 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
      • 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; use create(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 interface Function
        Returns:
        Parameters; never null
      • getImplementor

        public AggImplementor getImplementor​(boolean windowContext)
        Description copied from interface: ImplementableAggFunction
        Returns implementor that translates the function to linq4j expression.
        Specified by:
        getImplementor in interface ImplementableAggFunction
        Parameters:
        windowContext - true when aggregate is used in window context
        Returns:
        implementor that translates the function to linq4j expression.