It is fine to create a WindowedValue carrying no windows when it is a fully
reified WindowedValue<T>.

It is when it becomes an element in a PCollection that a value must exist
within some window. In a PCollection<WindowedValue<T>> you can have
elements that do not *contain* any windows, but exist *within* some window,
probably the global window.

But even though I can explain it like that,
WindowedValue.valueInEmptyWindows might just be a confusing API that we
don't need. It seems there are just 11 files that reference
WindowedValue.valueInEmptyWindows [1] that mostly look like they'd be fine
with the global window.

Kenn

[1]
https://github.com/apache/incubator-beam/search?p=1&q=valueInEmptyWindows&utf8=%E2%9C%93


On Wed, Apr 13, 2016 at 9:06 AM, Thomas Groh <[email protected]>
wrote:

> Actually, my above claim isn't as strong as it can be.
>
> A value in no windows is considered to not exist. Values that are not
> assigned to any window can be dropped by a runner at *any time*. A WindowFn
> *must* assign all elements to at least one window. All elements that are
> produced by any PTransform (including Sources) must be in a window,
> potentially the GlobalWindow.
>
> On Wed, Apr 13, 2016 at 8:52 AM, Thomas Groh <[email protected]> wrote:
>
> > Values should almost always be part of at least one window. WindowFns
> > should place all elements in at least one window, as values that are in
> no
> > windows will be dropped when they reach a GroupByKey.
> >
> > Elements in no windows, for example those created by
> > WindowedValue.valueInEmptyWindows(T) are generally an implementation
> > detail of a transform; for example, in the InProcessPipelineRunner, the
> KV<K,
> > Iterable<WindowedValue<V>>> elements output by a GroupByKeyOnly are in
> > empty windows - but by the time the element reaches the boundary of the
> > GroupByKey, the elements are reassigned to the appropriate window(s).
> >
> > On Tue, Apr 12, 2016 at 11:44 PM, Amit Sela <[email protected]>
> wrote:
> >
> >> My instinct tells me that if a value does not belong to a specific
> window
> >> (in time) it's a part of a global window, but if so, what's the role of
> >> the
> >> "empty window". When should an element be a "value in an empty window" ?
> >>
> >
> >
>

Reply via email to