Class MiniBatchGroupAggFunction

java.lang.Object
org.apache.flink.table.runtime.operators.bundle.MapBundleFunction<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>,org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>
org.apache.flink.table.runtime.operators.aggregate.MiniBatchGroupAggFunction
All Implemented Interfaces:
Serializable, org.apache.flink.api.common.functions.Function

public class MiniBatchGroupAggFunction extends MapBundleFunction<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>,org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>
Aggregate Function used for the groupby (without window) aggregate in miniBatch mode.

This function buffers input row in heap HashMap, and aggregates them when minibatch invoked.

See Also:
  • Constructor Details

    • MiniBatchGroupAggFunction

      public MiniBatchGroupAggFunction(GeneratedAggsHandleFunction genAggsHandler, GeneratedRecordEqualiser genRecordEqualiser, org.apache.flink.table.types.logical.LogicalType[] accTypes, org.apache.flink.table.types.logical.RowType inputType, int indexOfCountStar, boolean generateUpdateBefore, long stateRetentionTime)
      Parameters:
      genAggsHandler - The code generated function used to handle aggregates.
      genRecordEqualiser - The code generated equaliser used to equal RowData.
      accTypes - The accumulator types.
      inputType - The input row type.
      indexOfCountStar - The index of COUNT(*) in the aggregates. -1 when the input doesn't contain COUNT(*), i.e. doesn't contain retraction messages. We make sure there is a COUNT(*) if input stream contains retraction.
      generateUpdateBefore - Whether this operator will generate UPDATE_BEFORE messages.
      stateRetentionTime - state idle retention time which unit is MILLISECONDS.
  • Method Details

    • open

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

      public List<org.apache.flink.table.data.RowData> addInput(@Nullable List<org.apache.flink.table.data.RowData> value, org.apache.flink.table.data.RowData input) throws Exception
      Description copied from class: MapBundleFunction
      Adds the given input to the given value, returning the new bundle value.
      Specified by:
      addInput in class MapBundleFunction<org.apache.flink.table.data.RowData,List<org.apache.flink.table.data.RowData>,org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>
      Parameters:
      value - 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,List<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,List<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,List<org.apache.flink.table.data.RowData>,org.apache.flink.table.data.RowData,org.apache.flink.table.data.RowData>
      Throws:
      Exception