beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenneth Knowles (JIRA)" <>
Subject [jira] [Commented] (BEAM-912) Trigger can be more flexible
Date Tue, 08 Nov 2016 05:07:58 GMT


Kenneth Knowles commented on BEAM-912:

Very good point. My idea does not work for you. Actually the difficult part of your problem
isn't really windowing. Windows are how we decide to trigger and evict data when allowed lateness
is past - that is why {{BoundedWindow}} only has a maximum timestamp. But your problem is
challenging if we just talk about doing a range join in Beam, where only equi-joins on shared
keys are in the SDK/model. A naive way to do it is a full cross product and then filter the
data that matches. Some prominent big data products still do this, even though it is very

In Beam one way we could make this more efficient is with a side input (see
that supports range queries. Then collection B would be the main input, and collection A would
be the side inputs. The windowing of each of them would be just like the {{assignWindows}}
above, but with no merging. Then, because side inputs are only eventually consistent, you
would want to trigger collection B after some allowed lateness, and then downstream join it
with A and whatever elements from A had arrived would be the ones that are joined.

Triggers cannot solve this problem, and they are not designed to do your main computation
like this - they only control when results get output (sometimes we say "materialized") from
a {{GroupByKey}} or {{Combine}} - see

The solution you describe is how you might use a stateful {{ParDo}} to implement a per-key
range join, though I think the need for a data structure that supports range queries will
be the same to support out of order data. Your {{onElement}} becomes {{@ProcessElement}} and
{{BagState}} is the same. The state will be partitioned by key and window, so your example
would be globally windowed. Using state in your {{DoFn}} is something I am working on right
now, so you should follow BEAM-25 for updates on when it is ready for you to use, and check

> Trigger can be more flexible
> ------------------------------
>                 Key: BEAM-912
>                 URL:
>             Project: Beam
>          Issue Type: New Feature
>          Components: beam-model
>            Reporter: Jingsong Lee
>            Assignee: Kenneth Knowles
>         Attachments: betweenJoin.png
> 1.We can support some data-driven trigger, so we need expose data in OnElementContext
of onElement method. 
> 2.We can support more flexible join, so we need expose buffer tag in TriggerContext,
now this buffer tag is in SystemReduceFn.
> for example: SELECT STREAM * FROM Orders AS o JOIN Shipments AS s
> ON o.orderId = s.orderId AND s.rowtime BETWEEN o.rowtime AND o.rowtime + INTERVAL '1'
> link:

This message was sent by Atlassian JIRA

View raw message