You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by he...@apache.org on 2020/06/29 12:01:02 UTC

[flink] branch release-1.11 updated: [FLINK-17920][python][docs] Add the Python example of the Interval Join (#12779)

This is an automated email from the ASF dual-hosted git repository.

hequn pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.11 by this push:
     new 87eb508  [FLINK-17920][python][docs] Add the Python example of the Interval Join (#12779)
87eb508 is described below

commit 87eb508835871b4dc2ddf48c2c119e8e982ae07f
Author: Shuiqiang Chen <ac...@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    | 26 ++++++++++++++++++++++----
 docs/dev/table/tableApi.zh.md | 21 ++++++++++++++++++---
 2 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md
index fb46087..1fc323d 100644
--- a/docs/dev/table/tableApi.md
+++ b/docs/dev/table/tableApi.md
@@ -1169,7 +1169,7 @@ Table fullOuterResult = left.fullOuterJoin(right, $("a").isEqual($("d")))
       <td>
         <p><b>Note:</b> Interval joins are a subset of regular joins that can be processed in a streaming fashion.</p>
 
-        <p>A interval 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>&lt;, &lt;=, &gt;=, &gt;</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>An interval 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>&lt;, &lt;=, &gt;=, &gt;</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>
@@ -1322,7 +1322,7 @@ val fullOuterResult = left.fullOuterJoin(right, $"a" === $"d").select($"a", $"b"
       <td>
         <p><b>Note:</b> Interval joins are a subset of regular joins that can be processed in a streaming fashion.</p>
 
-        <p>A interval 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>&lt;, &lt;=, &gt;=, &gt;</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>An interval 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>&lt;, &lt;=, &gt;=, &gt;</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>
@@ -1459,9 +1459,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> Interval joins are a subset of regular joins that can be processed in a streaming fashion.</p>
+      
+              <p>An interval 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>&lt;, &lt;=, &gt;=, &gt;</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 &gt;= rtime &amp;&amp; ltime &lt; 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 f22ec9c..50fc728 100644
--- a/docs/dev/table/tableApi.zh.md
+++ b/docs/dev/table/tableApi.zh.md
@@ -1458,9 +1458,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> Interval Join 是所有常规流式数据处理join操作中的其中一种场景。</p>               
+                    <p>Interval Join 要求至少有一个等值连接条件以及一个用于划定时间间隔的条件。对两条数据流时间的划定可以通过两个范围比较确定一个合适时间区间(<code>&lt;, &lt;=, &gt;=, &gt;</code>), 也可以简单的通过对相同<a href="streaming/time_attributes.html">时间属性</a>(当前处理时间或事件时间)的时间值进行等值比较确定。</p>
+                    <p>如下示例是合法的Interval Join条件:</p>
+            
+                    <ul>
+                      <li><code>ltime = rtime</code></li>
+                      <li><code>ltime &gt;= rtime &amp;&amp; ltime &lt; 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>