Class StrictAggImplementor

    • Field Detail

      • needTrackEmptySet

        private boolean needTrackEmptySet
      • trackNullsPerRow

        private boolean trackNullsPerRow
      • stateSize

        private int stateSize
    • Constructor Detail

      • StrictAggImplementor

        public StrictAggImplementor()
    • Method Detail

      • nonDefaultOnEmptySet

        protected boolean nonDefaultOnEmptySet​(AggContext info)
      • getStateSize

        protected final int getStateSize()
      • getStateType

        public final java.util.List<java.lang.reflect.Type> getStateType​(AggContext info)
        Description copied from interface: AggImplementor
        Returns the types of the intermediate variables used by the aggregate implementation.

        For instance, for "concatenate to string" this can be StringBuilder. Calcite calls this method before all other implement* methods.

        Specified by:
        getStateType in interface AggImplementor
        Parameters:
        info - Aggregate context
        Returns:
        Types of the intermediate variables used by the aggregate implementation
      • anyNullable

        private boolean anyNullable​(java.util.List<? extends RelDataType> types)
      • getNotNullState

        public java.util.List<java.lang.reflect.Type> getNotNullState​(AggContext info)
      • implementReset

        public final void implementReset​(AggContext info,
                                         AggResetContext reset)
        Description copied from interface: AggImplementor
        Implements reset of the intermediate variables to the initial state. 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)));
        Specified by:
        implementReset in interface AggImplementor
        Parameters:
        info - Aggregate context
        reset - Reset context
      • implementResult

        public final Expression implementResult​(AggContext info,
                                                AggResultContext result)
        Description copied from interface: AggImplementor
        Calculates the resulting value based on the intermediate variables. Note: this method must NOT destroy the intermediate variables as calcite might reuse the state when calculating sliding aggregates. AggResetContext.accumulator() should be used to reference the state variables.
        Specified by:
        implementResult in interface AggImplementor
        Parameters:
        info - Aggregate context
        result - Result context
        Returns:
        Expression that is a result of calculating final value of the aggregate being implemented