The source for my windowed groupByKey experiment is here:

https://github.com/tweise/incubator-beam/blob/master/runners/apex/src/main/java/org/apache/beam/runners/apex/translators/functions/ApexGroupByKeyOperator.java

The result is Iterable<V>. In cases such as counting, what is the
recommended way to perform the incremental aggregation, without building an
intermediate collection?

Thomas

On Fri, Jun 17, 2016 at 8:27 AM, Thomas Weise <thomas.we...@gmail.com>
wrote:

> Hi,
>
> I'm looking into using the GroupAlsoByWindowViaWindowSetDoFn to accumulate
> the windowed state with the elements arriving one by one (stream).
>
> Once the window is complete, I would like to emit an Iterable<V> or
> another form of aggregation of the elements. Is the following supposed to
> lead to merging of current element with previously received elements for
> the same window:
>
>     KeyedWorkItem<K, V> kwi = KeyedWorkItems.elementsWorkItem(
>             kv.getKey(),
>             Collections.singletonList(updatedWindowedValue));
>
>     context.setElement(kwi, getStateInternalsForKey(kwi.key()));
>     fn.processElement(context);
>
> The input here are always single elements.
>
> Thanks,
> Thomas
>
>
>

Reply via email to