Class GroupByKeyAndWindowDoFnTransform<K,​InputT>

  • Type Parameters:
    K - key type.
    InputT - input type.
    All Implemented Interfaces:
    Serializable, Transform<org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,​InputT>>,​org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,​Iterable<InputT>>>>

    public final class GroupByKeyAndWindowDoFnTransform<K,​InputT>
    extends AbstractDoFnTransform<org.apache.beam.sdk.values.KV<K,​InputT>,​org.apache.beam.runners.core.KeyedWorkItem<K,​InputT>,​org.apache.beam.sdk.values.KV<K,​Iterable<InputT>>>
    Groups elements according to key and window.
    See Also:
    Serialized Form
    • Nested Class Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      GroupByKeyAndWindowDoFnTransform​(Map<org.apache.beam.sdk.values.TupleTag<?>,​org.apache.beam.sdk.coders.Coder<?>> outputCoders, org.apache.beam.sdk.values.TupleTag<org.apache.beam.sdk.values.KV<K,​Iterable<InputT>>> mainOutputTag, org.apache.beam.sdk.values.WindowingStrategy<?,​?> windowingStrategy, org.apache.beam.sdk.options.PipelineOptions options, org.apache.beam.runners.core.SystemReduceFn reduceFn, org.apache.beam.sdk.transforms.display.DisplayData displayData)
      GroupByKey constructor.
    • Constructor Detail

      • GroupByKeyAndWindowDoFnTransform

        public GroupByKeyAndWindowDoFnTransform​(Map<org.apache.beam.sdk.values.TupleTag<?>,​org.apache.beam.sdk.coders.Coder<?>> outputCoders,
                                                org.apache.beam.sdk.values.TupleTag<org.apache.beam.sdk.values.KV<K,​Iterable<InputT>>> mainOutputTag,
                                                org.apache.beam.sdk.values.WindowingStrategy<?,​?> windowingStrategy,
                                                org.apache.beam.sdk.options.PipelineOptions options,
                                                org.apache.beam.runners.core.SystemReduceFn reduceFn,
                                                org.apache.beam.sdk.transforms.display.DisplayData displayData)
        GroupByKey constructor.
        Parameters:
        outputCoders - output coders
        mainOutputTag - main output tag
        windowingStrategy - windowing strategy
        options - pipeline options
        reduceFn - reduce function
        displayData - display data.
    • Method Detail

      • wrapDoFn

        protected org.apache.beam.sdk.transforms.DoFn wrapDoFn​(org.apache.beam.sdk.transforms.DoFn doFn)
        This creates a new DoFn that groups elements by key and window.
        Parameters:
        doFn - original doFn.
        Returns:
        GroupAlsoByWindowViaWindowSetNewDoFn
      • onData

        public void onData​(org.apache.beam.sdk.util.WindowedValue<org.apache.beam.sdk.values.KV<K,​InputT>> element)
        It collects data for each key. The collected data are emitted at onWatermark(Watermark)
        Parameters:
        element - data element
      • onWatermark

        public void onWatermark​(Watermark inputWatermark)
        Description copied from interface: Transform
        On watermark received. This method should be called for the minimum watermark among input streams (input watermark). Transform may emit collected data after receiving watermarks.
        Parameters:
        inputWatermark - watermark
      • beforeClose

        protected void beforeClose()
        This advances the input watermark and processing time to the timestamp max value in order to emit all data.