com.hazelcast.jet.pipeline

## Class WindowGroupAggregateBuilder<K,R0>

- java.lang.Object
- - com.hazelcast.jet.pipeline.WindowGroupAggregateBuilder<K,R0>

- Type Parameters:
    `K` - type of the key
    `R0` - type of the aggregation result for stream-0

      public class WindowGroupAggregateBuilder<K,R0>
      extends Object

  Offers a step-by-step API to build a pipeline stage that performs a windowed co-grouping and aggregation of the data from several input stages. To obtain it, call `StageWithKeyAndWindow.aggregateBuilder()` on one of the stages to co-aggregate and refer to that method's Javadoc for further details.

  Note: this is not a builder of `AggregateOperation`. If that' s what you are looking for, go `here`.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T,R> Tag<R>` | `add(StreamStageWithKey<T,K> stage, AggregateOperation1<? super T,?,? extends R> aggrOp)` Adds another stage that will contribute its data to the windowed group-and-aggregate stage being constructed.
    `StreamStage<TimestampedEntry<K,ItemsByTag>>` | `build()` Convenience for `build(KeyedWindowResultFunction)` which results in a stage that emits `TimestampedEntry`s.
    `<OUT> StreamStage<OUT>` | `build(KeyedWindowResultFunction<? super K,ItemsByTag,OUT> mapToOutputFn)` Creates and returns a pipeline stage that performs a windowed cogroup-and-aggregate operation on the stages registered with this builder object.
    `Tag<R0>` | `tag0()` Returns the tag corresponding to the pipeline stage this builder was obtained from.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### tag0

          @Nonnull
          public Tag<R0> tag0()

      Returns the tag corresponding to the pipeline stage this builder was obtained from. Use this tag to refer to this stage when building the `AggregateOperation` that you'll pass to `build(aggrOp)`.

    - #### add

          @Nonnull
          public <T,R> Tag<R> add(@Nonnull
                                           StreamStageWithKey<T,K> stage,
                                           @Nonnull
                                           AggregateOperation1<? super T,?,? extends R> aggrOp)

      Adds another stage that will contribute its data to the windowed group-and-aggregate stage being constructed. Returns the tag you'll use to refer to this stage when building the `AggregateOperation` that you'll pass to `build()`.

    - #### build

          @Nonnull
          public <OUT> StreamStage<OUT> build(@Nonnull
                                                       KeyedWindowResultFunction<? super K,ItemsByTag,OUT> mapToOutputFn)

      Creates and returns a pipeline stage that performs a windowed cogroup-and-aggregate operation on the stages registered with this builder object. The composite aggregate operation places the results of the individual aggregate operations in an `ItemsByTag` and the `mapToOutputFn` you supply transforms it to the final result to emit. Use the tags you got from this builder in the implementation of `mapToOutputFn` to access the results.
      Type Parameters:
        `OUT` - the output item type
      Parameters:
        `mapToOutputFn` - function that transforms the aggregation result into the output item

    - #### build

          @Nonnull
          public StreamStage<TimestampedEntry<K,ItemsByTag>> build()

      Convenience for `build(KeyedWindowResultFunction)` which results in a stage that emits `TimestampedEntry`s. The timestamp of the entry corresponds to the timestamp of the window's end.

Copyright © 2018. All rights reserved.