Class MiniBatchGlobalGroupAggFunction

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function

    public class MiniBatchGlobalGroupAggFunction
    extends MapBundleFunction<org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData>
    Aggregate Function used for the global groupby (without window) aggregate in miniBatch mode.
    See Also:
    Serialized Form
    • Constructor Detail

      • MiniBatchGlobalGroupAggFunction

        public MiniBatchGlobalGroupAggFunction​(GeneratedAggsHandleFunction genLocalAggsHandler,
                                               GeneratedAggsHandleFunction genGlobalAggsHandler,
                                               GeneratedRecordEqualiser genRecordEqualiser,
                                               org.apache.flink.table.types.logical.LogicalType[] accTypes,
                                               int indexOfCountStar,
                                               boolean generateUpdateBefore,
                                               long stateRetentionTime)
        Parameters:
        genLocalAggsHandler - The generated local aggregate handler
        genGlobalAggsHandler - The generated global aggregate handler
        genRecordEqualiser - The code generated equaliser used to equal RowData.
        accTypes - The accumulator types.
        indexOfCountStar - The index of COUNT(*) in the aggregates. -1 when the input doesn't contain COUNT(*), i.e. doesn't contain UPDATE_BEFORE or DELETE messages. We make sure there is a COUNT(*) if input stream contains UPDATE_BEFORE or DELETE messages.
        generateUpdateBefore - Whether this operator will generate UPDATE_BEFORE messages.
        stateRetentionTime - state idle retention time which unit is MILLISECONDS.
    • Method Detail

      • open

        public void open​(ExecutionContext ctx)
                  throws Exception
        Overrides:
        open in class MapBundleFunction<org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData>
        Throws:
        Exception
      • addInput

        public org.apache.flink.table.data.RowData addInput​(@Nullable
                                                            org.apache.flink.table.data.RowData previousAcc,
                                                            org.apache.flink.table.data.RowData input)
                                                     throws Exception
        The previousAcc is accumulator, but input is a row in <key, accumulator> schema, the specific generated localAgg will project the input to accumulator in merge method.
        Specified by:
        addInput in class MapBundleFunction<org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData>
        Parameters:
        previousAcc - the existing bundle value, maybe null
        input - the given input, not null
        Throws:
        Exception
      • finishBundle

        public void finishBundle​(Map<org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData> buffer,
                                 org.apache.flink.util.Collector<org.apache.flink.table.data.RowData> out)
                          throws Exception
        Description copied from class: MapBundleFunction
        Called when a bundle is finished. Transform a bundle to zero, one, or more output elements.
        Specified by:
        finishBundle in class MapBundleFunction<org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData>
        Throws:
        Exception
      • close

        public void close()
                   throws Exception
        Overrides:
        close in class MapBundleFunction<org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData,​org.apache.flink.table.data.RowData>
        Throws:
        Exception