This is an automated email from the ASF dual-hosted git repository. hequn pushed a commit to branch release-1.10 in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.10 by this push: new d40bd0b [FLINK-17920][python][docs] Add the Python example of the Interval Join (#12779) d40bd0b is described below commit d40bd0b623c08d5a430362b9a940f83e463347f9 Author: Shuiqiang Chen <acqua....@alibaba-inc.com> AuthorDate: Mon Jun 29 19:57:53 2020 +0800 [FLINK-17920][python][docs] Add the Python example of the Interval Join (#12779) --- docs/dev/table/tableApi.md | 22 ++++++++++++++++++++-- docs/dev/table/tableApi.zh.md | 21 ++++++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md index e61a21a..ac98560 100644 --- a/docs/dev/table/tableApi.md +++ b/docs/dev/table/tableApi.md @@ -1326,9 +1326,27 @@ full_outer_result = left.full_outer_join(right, "a = d").select("a, b, e") <span class="label label-primary">Batch</span> <span class="label label-primary">Streaming</span> </td> - <td> - <p>Currently not supported in python API.</p> + + <td> + <p><b>Note:</b> Time-windowed joins are a subset of regular joins that can be processed in a streaming fashion.</p> + + <p>A Time-windowed join requires at least one equi-join predicate and a join condition that bounds the time on both sides. Such a condition can be defined by two appropriate range predicates (<code><, <=, >=, ></code>) or a single equality predicate that compares <a href="streaming/time_attributes.html">time attributes</a> of the same type (i.e., processing time or event time) of both input tables.</p> + <p>For example, the following predicates are valid interval join conditions:</p> + + <ul> + <li><code>ltime = rtime</code></li> + <li><code>ltime >= rtime && ltime < rtime + 2.second</code></li> + </ul> + + {% highlight python %} +left = table_env.from_path("Source1").select("a, b, c, rowtime1") +right = table_env.from_path("Source2").select("d, e, f, rowtime2") + +result = left.join(right).where("a = d && rowtime1 >= rowtime2 - 1.second + && rowtime1 <= rowtime2 + 2.second").select("a, b, e, rowtime1") + {% endhighlight %} </td> + </tr> <tr> <td> diff --git a/docs/dev/table/tableApi.zh.md b/docs/dev/table/tableApi.zh.md index ce034e9..c595bcf 100644 --- a/docs/dev/table/tableApi.zh.md +++ b/docs/dev/table/tableApi.zh.md @@ -1325,9 +1325,24 @@ full_outer_result = left.full_outer_join(right, "a = d").select("a, b, e") <span class="label label-primary">批处理</span> <span class="label label-primary">流处理</span> </td> - <td> - <p>Python API暂不支持。</p> - </td> + <td> + <p><b>注意:</b> Time-windowed Join 是所有常规流式数据处理join操作中的其中一种场景。</p> + <p>Time-windowed Join 要求至少有一个等值连接条件以及一个用于划定时间间隔的条件。对两条数据流时间的划定可以通过两个范围比较确定一个合适时间区间(<code><, <=, >=, ></code>), 也可以简单的通过对相同<a href="streaming/time_attributes.html">时间属性</a>(当前处理时间或事件时间)的时间值进行等值比较确定。</p> + <p>如下示例是合法的Time-windowed Join条件:</p> + + <ul> + <li><code>ltime = rtime</code></li> + <li><code>ltime >= rtime && ltime < rtime + 2.second</code></li> + </ul> + + {% highlight python %} +left = table_env.from_path("Source1").select("a, b, c, rowtime1") +right = table_env.from_path("Source2").select("d, e, f, rowtime2") + +result = left.join(right).where("a = d && rowtime1 >= rowtime2 - 1.second + && rowtime1 <= rowtime2 + 2.second").select("a, b, e, rowtime1") + {% endhighlight %} + </td> </tr> <tr> <td>