You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/07/06 05:40:11 UTC

[GitHub] [flink] klion26 commented on a change in pull request #12798: [FLINK-16087][docs-zh] Translate "Detecting Patterns" page of "Streaming Concepts" into Chinese

klion26 commented on a change in pull request #12798:
URL: https://github.com/apache/flink/pull/12798#discussion_r449984080



##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -24,28 +24,17 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-It is a common use case to search for a set of event patterns, especially in case of data streams.
-Flink comes with a [complex event processing (CEP) library]({{ site.baseurl }}/dev/libs/cep.html)
-which allows for pattern detection in event streams. Furthermore, Flink's SQL API provides a
-relational way of expressing queries with a large set of built-in functions and rule-based
-optimizations that can be used out of the box.
-
-In December 2016, the International Organization for Standardization (ISO) released a new version
-of the SQL standard which includes _Row Pattern Recognition in SQL_
-([ISO/IEC TR 19075-5:2016](https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip)).
-It allows Flink to consolidate CEP and SQL API using the `MATCH_RECOGNIZE` clause for complex event
-processing in SQL.
-
-A `MATCH_RECOGNIZE` clause enables the following tasks:
-* Logically partition and order the data that is used with the `PARTITION BY` and `ORDER BY`
-  clauses.
-* Define patterns of rows to seek using the `PATTERN` clause. These patterns use a syntax similar to
-  that of regular expressions.
-* The logical components of the row pattern variables are specified in the `DEFINE` clause.
-* Define measures, which are expressions usable in other parts of the SQL query, in the `MEASURES`
-  clause.
-
-The following example illustrates the syntax for basic pattern recognition:
+搜索一组事件模式(event pattern)是一种常见的用例,尤其是在数据流的情况下。Flink 提供 [复杂事件处理(CEP)库]({% link dev/libs/cep.zh.md %}),该库允许在事件流中进行模式检测。此外,Flink 的 SQL API 提供了一种关系式的查询表达方式,其中包含一大组内置函数和基于规则的优化,可以开箱即用。

Review comment:
       `一大组内置` -> `大量内置` 会更好一些吗

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -24,28 +24,17 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-It is a common use case to search for a set of event patterns, especially in case of data streams.
-Flink comes with a [complex event processing (CEP) library]({{ site.baseurl }}/dev/libs/cep.html)
-which allows for pattern detection in event streams. Furthermore, Flink's SQL API provides a
-relational way of expressing queries with a large set of built-in functions and rule-based
-optimizations that can be used out of the box.
-
-In December 2016, the International Organization for Standardization (ISO) released a new version
-of the SQL standard which includes _Row Pattern Recognition in SQL_
-([ISO/IEC TR 19075-5:2016](https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip)).
-It allows Flink to consolidate CEP and SQL API using the `MATCH_RECOGNIZE` clause for complex event
-processing in SQL.
-
-A `MATCH_RECOGNIZE` clause enables the following tasks:
-* Logically partition and order the data that is used with the `PARTITION BY` and `ORDER BY`
-  clauses.
-* Define patterns of rows to seek using the `PATTERN` clause. These patterns use a syntax similar to
-  that of regular expressions.
-* The logical components of the row pattern variables are specified in the `DEFINE` clause.
-* Define measures, which are expressions usable in other parts of the SQL query, in the `MEASURES`
-  clause.
-
-The following example illustrates the syntax for basic pattern recognition:
+搜索一组事件模式(event pattern)是一种常见的用例,尤其是在数据流的情况下。Flink 提供 [复杂事件处理(CEP)库]({% link dev/libs/cep.zh.md %}),该库允许在事件流中进行模式检测。此外,Flink 的 SQL API 提供了一种关系式的查询表达方式,其中包含一大组内置函数和基于规则的优化,可以开箱即用。
+
+2016年12月,国际标准化组织(ISO)发布了新版本的 SQL 标准,其中包括在 _SQL 中的行模式识别(Row Pattern Recognition in SQL)_([ISO/IEC TR 19075-5:2016](https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip))。它允许 Flink 使用 `MATCH_RECOGNIZE` 子句融合 CEP 和 SQL API,以便在 SQL 中进行复杂事件处理。

Review comment:
       ```suggestion
   2016 年 12 月,国际标准化组织(ISO)发布了新版本的 SQL 标准,其中包括在 _SQL 中的行模式识别(Row Pattern Recognition in SQL)_([ISO/IEC TR 19075-5:2016](https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip))。它允许 Flink 使用 `MATCH_RECOGNIZE` 子句融合 CEP 和 SQL API,以便在 SQL 中进行复杂事件处理。
   ```

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -65,24 +54,19 @@ FROM MyTable
     ) AS T
 {% endhighlight %}
 
-This page will explain each keyword in more detail and will illustrate more complex examples.
+本页将更详细地解释每个关键字,并演示说明更复杂的示例。
 
-<span class="label label-danger">Attention</span> Flink's implementation of the `MATCH_RECOGNIZE`
-clause is a subset of the full standard. Only those features documented in the following sections
-are supported. Since the development is still in an early phase, please also take a look at the
-[known limitations](#known-limitations).
+<span class="label label-danger">注意</span> Flink 的 `MATCH_RECOGNIZE` 子句实现是完整标准的一个子集。仅支持以下部分中记录的功能。由于开发仍处于初期阶段,请查看[已知的局限](#已知的局限)。

Review comment:
       标题的链接一般建议增加 `<a>` 标签,具体可以参考 [cwiki](https://cwiki.apache.org/confluence/display/FLINK/Flink+Translation+Specifications) 的第 4 点
   
   本文其他地方也一样

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -24,28 +24,17 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-It is a common use case to search for a set of event patterns, especially in case of data streams.
-Flink comes with a [complex event processing (CEP) library]({{ site.baseurl }}/dev/libs/cep.html)
-which allows for pattern detection in event streams. Furthermore, Flink's SQL API provides a
-relational way of expressing queries with a large set of built-in functions and rule-based
-optimizations that can be used out of the box.
-
-In December 2016, the International Organization for Standardization (ISO) released a new version
-of the SQL standard which includes _Row Pattern Recognition in SQL_
-([ISO/IEC TR 19075-5:2016](https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip)).
-It allows Flink to consolidate CEP and SQL API using the `MATCH_RECOGNIZE` clause for complex event
-processing in SQL.
-
-A `MATCH_RECOGNIZE` clause enables the following tasks:
-* Logically partition and order the data that is used with the `PARTITION BY` and `ORDER BY`
-  clauses.
-* Define patterns of rows to seek using the `PATTERN` clause. These patterns use a syntax similar to
-  that of regular expressions.
-* The logical components of the row pattern variables are specified in the `DEFINE` clause.
-* Define measures, which are expressions usable in other parts of the SQL query, in the `MEASURES`
-  clause.
-
-The following example illustrates the syntax for basic pattern recognition:
+搜索一组事件模式(event pattern)是一种常见的用例,尤其是在数据流的情况下。Flink 提供 [复杂事件处理(CEP)库]({% link dev/libs/cep.zh.md %}),该库允许在事件流中进行模式检测。此外,Flink 的 SQL API 提供了一种关系式的查询表达方式,其中包含一大组内置函数和基于规则的优化,可以开箱即用。
+
+2016年12月,国际标准化组织(ISO)发布了新版本的 SQL 标准,其中包括在 _SQL 中的行模式识别(Row Pattern Recognition in SQL)_([ISO/IEC TR 19075-5:2016](https://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip))。它允许 Flink 使用 `MATCH_RECOGNIZE` 子句融合 CEP 和 SQL API,以便在 SQL 中进行复杂事件处理。
+
+`MATCH_RECOGNIZE` 子句启用以下任务:
+* 对与 `PARTITION BY` 和 `ORDER BY` 子句一起使用的数据进行逻辑分区和排序。

Review comment:
       ”对与 `PARTITION BY` 和 `ORDER BY` 子句“ -> "对 `PARTITION BY` 和 `ORDER BY` 子句" 会更好一些吗

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -65,24 +54,19 @@ FROM MyTable
     ) AS T
 {% endhighlight %}
 
-This page will explain each keyword in more detail and will illustrate more complex examples.
+本页将更详细地解释每个关键字,并演示说明更复杂的示例。
 
-<span class="label label-danger">Attention</span> Flink's implementation of the `MATCH_RECOGNIZE`
-clause is a subset of the full standard. Only those features documented in the following sections
-are supported. Since the development is still in an early phase, please also take a look at the
-[known limitations](#known-limitations).
+<span class="label label-danger">注意</span> Flink 的 `MATCH_RECOGNIZE` 子句实现是完整标准的一个子集。仅支持以下部分中记录的功能。由于开发仍处于初期阶段,请查看[已知的局限](#已知的局限)。
 
 * This will be replaced by the TOC
 {:toc}
 
-Introduction and Examples
+介绍和示例
 -------------------------
 
-### Installation Guide
+### 安装指南
 
-The pattern recognition feature uses the Apache Flink's CEP library internally. In order to be able
-to use the `MATCH_RECOGNIZE` clause, the library needs to be added as a dependency to your Maven
-project.
+模式识别特性在使用 Apache Flink 内部的 CEP 库。为了能够使用 `MATCH_RECOGNIZE` 子句,需要将库作为依赖项添加到 Maven 项目中。

Review comment:
       ```suggestion
   模式识别特性使用 Apache Flink 内部的 CEP 库。为了能够使用 `MATCH_RECOGNIZE` 子句,需要将库作为依赖项添加到 Maven 项目中。
   ```

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -92,52 +76,39 @@ project.
 </dependency>
 {% endhighlight %}
 
-Alternatively, you can also add the dependency to the cluster classpath (see the
-[dependency section]({{ site.baseurl}}/dev/project-configuration.html) for more information).
+或者,也可以将依赖项添加到集群类路径(查看[依赖部分]({% link dev/project-configuration.zh.md %})获取更多信息)。
 
-If you want to use the `MATCH_RECOGNIZE` clause in the
-[SQL Client]({{ site.baseurl}}/dev/table/sqlClient.html), you don't have to do anything as all the
-dependencies are included by default.
+如果你想在 [SQL Client]({% link dev/table/sqlClient.zh.md %}) 中使用 `MATCH_RECOGNIZE` 子句,你无需执行任何操作,因为默认情况下包含所有依赖项。
 
-### SQL Semantics
+### SQL 语义
 
-Every `MATCH_RECOGNIZE` query consists of the following clauses:
+每个 `MATCH_RECOGNIZE` 查询都包含以下子句:
 
-* [PARTITION BY](#partitioning) - defines the logical partitioning of the table; similar to a
-  `GROUP BY` operation.
-* [ORDER BY](#order-of-events) - specifies how the incoming rows should be ordered; this is
-  essential as patterns depend on an order.
-* [MEASURES](#define--measures) - defines output of the clause; similar to a `SELECT` clause.
-* [ONE ROW PER MATCH](#output-mode) - output mode which defines how many rows per match should be
-  produced.
-* [AFTER MATCH SKIP](#after-match-strategy) - specifies where the next match should start; this is
-  also a way to control how many distinct matches a single event can belong to.
-* [PATTERN](#defining-a-pattern) - allows constructing patterns that will be searched for using a
-  _regular expression_-like syntax.
-* [DEFINE](#define--measures) - this section defines the conditions that the pattern variables must
-  satisfy.
+* [PARTITION BY](#分区) - 定义表的逻辑分区;类似于 `GROUP BY` 操作。

Review comment:
       这里业内的跳转建议使用 `<a> `标签

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -92,52 +76,39 @@ project.
 </dependency>
 {% endhighlight %}
 
-Alternatively, you can also add the dependency to the cluster classpath (see the
-[dependency section]({{ site.baseurl}}/dev/project-configuration.html) for more information).
+或者,也可以将依赖项添加到集群类路径(查看[依赖部分]({% link dev/project-configuration.zh.md %})获取更多信息)。

Review comment:
       这个地方 classpath 不翻译的话是否可以呢?classpath 更像是一个专有名词。
   `依赖部分` 这里能否换成一个更具体的名词呢?目标页面有很多个 依赖的 section

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -311,10 +247,8 @@ symbol         rowtime         price    tax
 'ACME'  '01-Apr-11 10:00:11'   30      1
 {% endhighlight %}
 
-The query will accumulate events as part of the pattern variable `A` as long as the average price
-of them does not exceed `15`. For example, such a limit exceeding happens at `01-Apr-11 10:00:04`.
-The following period exceeds the average price of `15` again at `01-Apr-11 10:00:11`. Thus the
-results for said query will be:
+只要事件的平均价格不超过 `15`,查询就会将事件作为模式变量 `A` 的一部分进行累积。
+例如,这种限制发生在`01-Apr-11 10:00:04`。接下来的时间段在 `01-Apr-11 10:00:11` 再次超过平均价格 `15`。因此,所述查询的结果将是:

Review comment:
       ```suggestion
   例如,这种限制发生在 `01-Apr-11 10:00:04`。接下来的时间段在 `01-Apr-11 10:00:11` 再次超过平均价格 `15`。因此,所述查询的结果将是:
   ```

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -323,52 +257,43 @@ ACME       01-APR-11 10:00:00  01-APR-11 10:00:03     14.5
 ACME       01-APR-11 10:00:05  01-APR-11 10:00:10     13.5
 {% endhighlight %}
 
-<span class="label label-info">Note</span> Aggregations can be applied to expressions, but only if
-they reference a single pattern variable. Thus `SUM(A.price * A.tax)` is a valid one, but
-`AVG(A.price * B.tax)` is not.
+<span class="label label-info">注意</span> 聚合可以应用于表达式,但前提是它们引用单个模式变量。因此,`SUM(A.price * A.tax)` 是有效的,而 `AVG(A.price * B.tax)` 则是无效的。
 
-<span class="label label-danger">Attention</span> `DISTINCT` aggregations are not supported.
+<span class="label label-danger">注意</span> 不支持 `DISTINCT` 聚合。
 
-Defining a Pattern
+定义模式
 ------------------
 
-The `MATCH_RECOGNIZE` clause allows users to search for patterns in event streams using a powerful
-and expressive syntax that is somewhat similar to the widespread regular expression syntax.
+`MATCH_RECOGNIZE` 子句允许用户在事件流中使用功能强大、表达力强的语法搜索模式,这种语法与广泛使用的正则表达式语法有些相似。
 
-Every pattern is constructed from basic building blocks, called _pattern variables_, to which
-operators (quantifiers and other modifiers) can be applied. The whole pattern must be enclosed in
-brackets.
+每个模式都是由基本的构建块构造的,称为 _pattern variables_,可以应用算子(量词和其他修饰符)到这些模块中。整个模式必须用括号括起来。
 
-An example pattern could look like:
+示例模式如下所示:
 
 {% highlight sql %}
 PATTERN (A B+ C* D)
 {% endhighlight %}
 
-One may use the following operators:
+可以使用以下算子:
+
+* _Concatenation_ - 像 `(A B)` 这样的模式意味着 `A` 和 `B` 之间的连接是严格的。因此,在它们之间不能存在没有映射到 `A` 或 `B` 的行。
+* _Quantifiers_ - 修改可以映射到模式变量的行数。
+  * `*` — _0_ 或者多行
+  * `+` — _1_ 或者多行
+  * `?` — _0_ 或者 _1_ 行
+  * `{ n }` — 严格 _n_ 行(_n > 0_)
+  * `{ n, }` — _n_ 或者更多行(_n ≥ 0_)
+  * `{ n, m }` — 在 _n_ 到 _m_(包含)行之间(_0 ≤ n ≤ m,0 < m_)
+  * `{ , m }` — 在 _0_ 到 _m_(包含)行之间(_m > 0_)
 
-* _Concatenation_ - a pattern like `(A B)` means that the contiguity is strict between `A` and `B`.
-  Therefore, there can be no rows that were not mapped to `A` or `B` in between.
-* _Quantifiers_ - modify the number of rows that can be mapped to the pattern variable.
-  * `*` — _0_ or more rows
-  * `+` — _1_ or more rows
-  * `?` — _0_ or _1_ rows
-  * `{ n }` — exactly _n_ rows (_n > 0_)
-  * `{ n, }` — _n_ or more rows (_n ≥ 0_)
-  * `{ n, m }` — between _n_ and _m_ (inclusive) rows (_0 ≤ n ≤ m, 0 < m_)
-  * `{ , m }` — between _0_ and _m_ (inclusive) rows (_m > 0_)
 
-<span class="label label-danger">Attention</span> Patterns that can potentially produce an empty
-match are not supported. Examples of such patterns are `PATTERN (A*)`, `PATTERN  (A? B*)`,
-`PATTERN (A{0,} B{0,} C*)`, etc.
+<span class="label label-danger">注意</span> 不支持可能产生空匹配的模式。此类模式的示例如 `PATTERN (A*)`,`PATTERN  (A? B*)`,`PATTERN (A{0,} B{0,} C*)` 等。
 
-### Greedy & Reluctant Quantifiers
+### 贪婪和勉强量词

Review comment:
       个人感觉:这两个翻译可以再优化下

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -180,99 +150,65 @@ FROM Ticker
     ) MR;
 {% endhighlight %}
 
-The query partitions the `Ticker` table by the `symbol` column and orders it by the `rowtime`
-time attribute.
+此查询将 `Ticker` 表按照 `symbol` 列进行分区并按照 `rowtime` 属性进行排序。
 
-The `PATTERN` clause specifies that we are interested in a pattern with a starting event `START_ROW`
-that is followed by one or more `PRICE_DOWN` events and concluded with a `PRICE_UP` event. If such
-a pattern can be found, the next pattern match will be seeked at the last `PRICE_UP` event as
-indicated by the `AFTER MATCH SKIP TO LAST` clause.
+`PATTERN` 子句指定我们对以下模式感兴趣:该模式具有开始事件 `START_ROW`,然后是一个或多个 `PRICE_DOWN` 事件,并以 `PRICE_UP` 事件结束。如果可以找到这样的模式,如 `AFTER MATCH SKIP TO LAST` 子句所示,则从最后一个 `PRICE_UP` 事件开始寻找下一个模式匹配。
 
-The `DEFINE` clause specifies the conditions that need to be met for a `PRICE_DOWN` and `PRICE_UP`
-event. Although the `START_ROW` pattern variable is not present it has an implicit condition that
-is evaluated always as `TRUE`.
+`DEFINE` 子句指定 `PRICE_DOWN` 和 `PRICE_UP` 事件需要满足的条件。尽管不存在 `START_ROW` 模式变量,但它具有一个始终被评估为 `TRUE` 隐式条件。
 
-A pattern variable `PRICE_DOWN` is defined as a row with a price that is smaller than the price of
-the last row that met the `PRICE_DOWN` condition. For the initial case or when there is no last row
-that met the `PRICE_DOWN` condition, the price of the row should be smaller than the price of the
-preceding row in the pattern (referenced by `START_ROW`).
+模式变量 `PRICE_DOWN` 定义为价格小于满足 `PRICE_DOWN` 条件的最后一行价格的行。对于初始情况或没有满足 `PRICE_DOWN` 条件的最后一行时,该行的价格应小于该模式中前一行(由 `START_ROW` 引用)的价格。
 
-A pattern variable `PRICE_UP` is defined as a row with a price that is larger than the price of the
-last row that met the `PRICE_DOWN` condition.
+模变变量 `PRICE_UP` 定义为价格大于满足 `PRICE_DOWN` 条件的最后一行价格的行。
 
-This query produces a summary row for each period in which the price of a stock was continuously
-decreasing.
+此查询为股票价格持续下跌的每个期间生成摘要行。
 
-The exact representation of the output rows is defined in the `MEASURES` part of the query. The
-number of output rows is defined by the `ONE ROW PER MATCH` output mode.
+输出行的确切表示在查询的 `MEASURES` 部分中定义。输出行数由 `ONE ROW PER MATCH` 输出方式定义。
 
 {% highlight text %}
  symbol       start_tstamp       bottom_tstamp         end_tstamp
 =========  ==================  ==================  ==================
 ACME       01-APR-11 10:00:04  01-APR-11 10:00:07  01-APR-11 10:00:08
 {% endhighlight %}
 
-The resulting row describes a period of falling prices that started at `01-APR-11 10:00:04` and
-achieved the lowest price at `01-APR-11 10:00:07` that increased again at `01-APR-11 10:00:08`.
+该行结果描述了从 `01-APR-11 10:00:04` 开始的价格下跌期,在 `01-APR-11 10:00:07` 达到最低价格,到 `01-APR-11 10:00:08` 再次上涨。
 
-Partitioning
+
+分区
 ------------
 
-It is possible to look for patterns in partitioned data, e.g., trends for a single ticker or a
-particular user. This can be expressed using the `PARTITION BY` clause. The clause is similar to
-using `GROUP BY` for aggregations.
+可以在分区数据中寻找模式,例如单个股票行情或特定用户的趋势。这可以用 `PARTITION BY` 子句来表示。该子句类似于对聚合使用 `GROUP BY`。
 
-<span class="label label-danger">Attention</span> It is highly advised to partition the incoming
-data because otherwise the `MATCH_RECOGNIZE` clause will be translated into a non-parallel operator
-to ensure global ordering.
+<span class="label label-danger">注意</span> 强烈建议对传入的数据进行分区,否则 `MATCH_RECOGNIZE` 子句将被转换为非并行算子,以确保全局排序。
 
-Order of Events
+事件顺序
 ---------------
 
-Apache Flink allows for searching for patterns based on time; either
-[processing time or event time](time_attributes.html).
+Apache Flink 可以根据时间([processing time or event time]({% link dev/table/streaming/time_attributes.zh.md %}))进行模式搜索。
 
-In case of event time, the events are sorted before they are passed to the internal pattern state
-machine. As a consequence, the produced output will be correct regardless of the order in which
-rows are appended to the table. Instead, the pattern is evaluated in the order specified by the
-time contained in each row.
+如果是 event time,则在将事件传递到内部模式状态机之前对其进行排序。所以,无论行添加到表的顺序如何,生成的输出都是正确的。相反,模式是按照每行中包含的时间指定的顺序计算的。
 
-The `MATCH_RECOGNIZE` clause assumes a [time attribute](time_attributes.html) with ascending
-ordering as the first argument to `ORDER BY` clause.
+`MATCH_RECOGNIZE` 子句假定升序的 [time attribute]({% link dev/table/streaming/time_attributes.zh.md %}) 是 `ORDER BY` 子句的第一个参数。
 
-For the example `Ticker` table, a definition like `ORDER BY rowtime ASC, price DESC` is valid but
-`ORDER BY price, rowtime` or `ORDER BY rowtime DESC, price ASC` is not.
+对于示例 `Ticker` 表,诸如 `ORDER BY rowtime ASC, price DESC` 的定义是有效的,但 `ORDER BY price, rowtime` 或者 `ORDER BY rowtime DESC, price ASC` 是无效的。
 
 Define & Measures
 -----------------
 
-The `DEFINE` and `MEASURES` keywords have similar meanings to the `WHERE` and `SELECT` clauses in a
-simple SQL query.
+`DEFINE` 和 `MEASURES` 关键字与简单 SQL 查询中的 `WHERE` 和 `SELECT` 子句具有相近的含义。
 
-The `MEASURES` clause defines what will be included in the output of a matching pattern. It can
-project columns and define expressions for evaluation. The number of produced rows depends on the
-[output mode](#output-mode) setting.
+`MEASURES` 子句定义匹配模式的输出中要包含哪些内容。它可以投影列并定义表达式进行计算。产生的行数取决于 [output mode](#输出方式) 设置。
 
-The `DEFINE` clause specifies conditions that rows have to fulfill in order to be classified to a
-corresponding [pattern variable](#defining-a-pattern). If a condition is not defined for a pattern
-variable, a default condition will be used which evaluates to `true` for every row.
+`DEFINE` 子句指定行必须满足的条件才能被分类到相应的 [pattern variable](#定义模式)。如果没有为模式变量定义条件,则将使用对每一行的计算结果为 `true` 的默认条件。
 
-For a more detailed explanation about expressions that can be used in those clauses, please have a
-look at the [event stream navigation](#pattern-navigation) section.
+有关在这些子句中可使用的表达式的更详细的说明,请查看 [event stream navigation](#模式导航) 部分。
 
 ### Aggregations
 
-Aggregations can be used in `DEFINE` and `MEASURES` clauses. Both
-[built-in]({{ site.baseurl }}/dev/table/functions/systemFunctions.html) and custom
-[user defined]({{ site.baseurl }}/dev/table/functions/udfs.html) functions are supported.
+Aggregations 可以在 `DEFINE` 和 `MEASURES` 子句中使用。支持 [built-in]({% link dev/table/functions/systemFunctions.zh.md %}) 和用户 [user defined]({% link dev/table/functions/udfs.zh.md %}) 函数。

Review comment:
       这里是否翻译成 `内置函数` 和 `用户自定义函数` 会更好呢?

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -720,8 +610,7 @@ LAST(variable.field, n)
 {% endhighlight %}
     </td>
     <td>
-      <p>Returns the value of the field from the event that was mapped to the <i>n</i>-th
-      <i>last</i> element of the variable. The counting starts at the last element mapped.</p>
+      <p>返回映射到变量最后n个元素的事件中的字段值。计数从映射的最后一个元素开始。</p>

Review comment:
       ```suggestion
         <p>返回映射到变量最后 n 个元素的事件中的字段值。计数从映射的最后一个元素开始。</p>
   ``` 
   英文/数字 与 中文间需要有空格,本文其他地方也可以检查下

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -180,99 +150,65 @@ FROM Ticker
     ) MR;
 {% endhighlight %}
 
-The query partitions the `Ticker` table by the `symbol` column and orders it by the `rowtime`
-time attribute.
+此查询将 `Ticker` 表按照 `symbol` 列进行分区并按照 `rowtime` 属性进行排序。
 
-The `PATTERN` clause specifies that we are interested in a pattern with a starting event `START_ROW`
-that is followed by one or more `PRICE_DOWN` events and concluded with a `PRICE_UP` event. If such
-a pattern can be found, the next pattern match will be seeked at the last `PRICE_UP` event as
-indicated by the `AFTER MATCH SKIP TO LAST` clause.
+`PATTERN` 子句指定我们对以下模式感兴趣:该模式具有开始事件 `START_ROW`,然后是一个或多个 `PRICE_DOWN` 事件,并以 `PRICE_UP` 事件结束。如果可以找到这样的模式,如 `AFTER MATCH SKIP TO LAST` 子句所示,则从最后一个 `PRICE_UP` 事件开始寻找下一个模式匹配。
 
-The `DEFINE` clause specifies the conditions that need to be met for a `PRICE_DOWN` and `PRICE_UP`
-event. Although the `START_ROW` pattern variable is not present it has an implicit condition that
-is evaluated always as `TRUE`.
+`DEFINE` 子句指定 `PRICE_DOWN` 和 `PRICE_UP` 事件需要满足的条件。尽管不存在 `START_ROW` 模式变量,但它具有一个始终被评估为 `TRUE` 隐式条件。
 
-A pattern variable `PRICE_DOWN` is defined as a row with a price that is smaller than the price of
-the last row that met the `PRICE_DOWN` condition. For the initial case or when there is no last row
-that met the `PRICE_DOWN` condition, the price of the row should be smaller than the price of the
-preceding row in the pattern (referenced by `START_ROW`).
+模式变量 `PRICE_DOWN` 定义为价格小于满足 `PRICE_DOWN` 条件的最后一行价格的行。对于初始情况或没有满足 `PRICE_DOWN` 条件的最后一行时,该行的价格应小于该模式中前一行(由 `START_ROW` 引用)的价格。
 
-A pattern variable `PRICE_UP` is defined as a row with a price that is larger than the price of the
-last row that met the `PRICE_DOWN` condition.
+模变变量 `PRICE_UP` 定义为价格大于满足 `PRICE_DOWN` 条件的最后一行价格的行。
 
-This query produces a summary row for each period in which the price of a stock was continuously
-decreasing.
+此查询为股票价格持续下跌的每个期间生成摘要行。
 
-The exact representation of the output rows is defined in the `MEASURES` part of the query. The
-number of output rows is defined by the `ONE ROW PER MATCH` output mode.
+输出行的确切表示在查询的 `MEASURES` 部分中定义。输出行数由 `ONE ROW PER MATCH` 输出方式定义。
 
 {% highlight text %}
  symbol       start_tstamp       bottom_tstamp         end_tstamp
 =========  ==================  ==================  ==================
 ACME       01-APR-11 10:00:04  01-APR-11 10:00:07  01-APR-11 10:00:08
 {% endhighlight %}
 
-The resulting row describes a period of falling prices that started at `01-APR-11 10:00:04` and
-achieved the lowest price at `01-APR-11 10:00:07` that increased again at `01-APR-11 10:00:08`.
+该行结果描述了从 `01-APR-11 10:00:04` 开始的价格下跌期,在 `01-APR-11 10:00:07` 达到最低价格,到 `01-APR-11 10:00:08` 再次上涨。
 
-Partitioning
+
+分区
 ------------
 
-It is possible to look for patterns in partitioned data, e.g., trends for a single ticker or a
-particular user. This can be expressed using the `PARTITION BY` clause. The clause is similar to
-using `GROUP BY` for aggregations.
+可以在分区数据中寻找模式,例如单个股票行情或特定用户的趋势。这可以用 `PARTITION BY` 子句来表示。该子句类似于对聚合使用 `GROUP BY`。
 
-<span class="label label-danger">Attention</span> It is highly advised to partition the incoming
-data because otherwise the `MATCH_RECOGNIZE` clause will be translated into a non-parallel operator
-to ensure global ordering.
+<span class="label label-danger">注意</span> 强烈建议对传入的数据进行分区,否则 `MATCH_RECOGNIZE` 子句将被转换为非并行算子,以确保全局排序。
 
-Order of Events
+事件顺序
 ---------------
 
-Apache Flink allows for searching for patterns based on time; either
-[processing time or event time](time_attributes.html).
+Apache Flink 可以根据时间([processing time or event time]({% link dev/table/streaming/time_attributes.zh.md %}))进行模式搜索。

Review comment:
       `processing time or event time` 这里是否可以翻译下呢?
   文章中其他地方也一样。在目标页面中这两个名词已经翻译成中文了

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -1035,34 +899,28 @@ use [time attributes](time_attributes.html). To select those there are available
       <td>
         <code>MATCH_ROWTIME()</code><br/>
       </td>
-      <td><p>Returns the timestamp of the last row that was mapped to the given pattern.</p>
-      <p>The resulting attribute is a <a href="time_attributes.html">rowtime attribute</a>
-         that can be used in subsequent time-based operations such as
-         <a href="#joins">interval joins</a> and <a href="#aggregations">group window or over
-         window aggregations</a>.</p></td>
+      <td>
+        <p>返回映射到给定模式的最后一行的时间戳。</p>
+        <p>结果属性是 <a href="{% link dev/table/streaming/time_attributes.zh.md %}">rowtime attribute</a>,可用于后续基于时间的操作,例如 <a href="{% link dev/table/streaming/joins.zh.md %}#interval-joins">interval joins</a> 和 <a href="#aggregations">group window or over window aggregations</a>。</p>
+      </td>
     </tr>
     <tr>
       <td>
         <code>MATCH_PROCTIME()</code><br/>
       </td>
-      <td><p>Returns a <a href="time_attributes.html#processing-time">proctime attribute</a>
-          that can be used in subsequent time-based operations such as
-          <a href="#joins">interval joins</a> and <a href="#aggregations">group window or over
-          window aggregations</a>.</p></td>
+      <td>
+        <p>返回 <a href="{% link dev/table/streaming/time_attributes.zh.md %}#处理时间">proctime attribute</a>,该属性可用于随后的基于时间的操作,例如 <a href="{% link dev/table/streaming/joins.zh.md %}#interval-joins">interval joins</a> 和 <a href="#aggregations">group window or over window aggregations</a>。</p>

Review comment:
       时间属性相关的英文建议翻译一下,目标文档已经翻译成中文了

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -498,36 +409,30 @@ symbol         rowtime         price    tax
 'ACME'  '01-Apr-11 13:20:00'   19      1
 {% endhighlight %}
 
-The query will produce the following results:
+查询将生成以下结果:
 
 {% highlight text %}
 symbol         dropTime         dropDiff
 ======  ====================  =============
 'ACME'  '01-Apr-11 13:00:00'      14
 {% endhighlight %}
 
-The resulting row represents a price drop from `15` (at `01-Apr-11 12:00:00`) to `1` (at
-`01-Apr-11 13:00:00`). The `dropDiff` column contains the price difference.
+结果行代表价格从`15`(在`01-Apr-11 12:00:00`)下降到`1`(在`01-Apr-11 13:00:00`)。`dropDiff` 列包含价格差异。
 
-Notice that even though prices also drop by higher values, for example, by `11` (between
-`01-Apr-11 10:00:00` and `01-Apr-11 11:40:00`), the time difference between those two events is
-larger than 1 hour. Thus, they don't produce a match.
+请注意,即使价格也下降了较高的值,例如,下降了`11`(在`01-Apr-11 10:00:00`和`01-Apr-11 11:40:00`之间),这两个事件之间的时间差大于1小时。因此,它们不会产生匹配。
 
-Output Mode
+输出方式
 -----------
 
-The _output mode_ describes how many rows should be emitted for every found match. The SQL standard
-describes two modes:
+_output mode_ 描述每个找到的匹配项应该输出多少行。SQL 标准描述了两种方式:
 - `ALL ROWS PER MATCH`
-- `ONE ROW PER MATCH`.
+- `ONE ROW PER MATCH`。

Review comment:
       这里渲染之后是列表,“。”是否可以去掉呢?

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -558,43 +463,36 @@ For the following input rows:
  XYZ      2     11       2018-09-17 10:00:05
 {% endhighlight %}
 
-The query will produce the following output:
+该查询将生成以下输出:
 
 {% highlight text %}
  symbol   startPrice   topPrice   lastPrice
 ======== ============ ========== ===========
  XYZ      10           13         11
 {% endhighlight %}
 
-The pattern recognition is partitioned by the `symbol` column. Even though not explicitly mentioned
-in the `MEASURES` clause, the partitioned column is added at the beginning of the result.
+该模式识别由 `symbol` 列分区。即使在 `MEASURES` 子句中未明确提及,分区列仍会添加到结果的开头。
 
-Pattern Navigation
+模式导航
 ------------------
 
-The `DEFINE` and `MEASURES` clauses allow for navigating within the list of rows that (potentially)
-match a pattern.
+`DEFINE` 和 `MEASURES` 子句允许在(可能)匹配模式的行列表中进行导航。
 
-This section discusses this navigation for declaring conditions or producing output results.
+本节讨论用于声明条件或产生输出结果的导航。
 
-### Pattern Variable Referencing
+### 引用模式变量
 
-A _pattern variable reference_ allows a set of rows mapped to a particular pattern variable in the
-`DEFINE` or `MEASURES` clauses to be referenced.
+_pattern variable reference_ 允许引用一组映射到 `DEFINE` 或 `MEASURES` 子句中特定模式变量的行。

Review comment:
       上面对这个名词做了翻译,这里为什么又用原文呢?

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -419,13 +343,9 @@ produce:
  XYZ      16
 {% endhighlight %}
 
-The pattern variable `B` matches only to the row with price `12` instead of swallowing the rows
-with prices `12`, `13`, and `14`.
+模式变量 `B` 只匹配价格为`12`的行,而不是包含价格为`12`、`13`和`14`的行。

Review comment:
       ```suggestion
   模式变量 `B` 只匹配价格为 `12` 的行,而不是包含价格为 `12`、`13` 和 `14` 的行。
   ```

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -558,43 +463,36 @@ For the following input rows:
  XYZ      2     11       2018-09-17 10:00:05
 {% endhighlight %}
 
-The query will produce the following output:
+该查询将生成以下输出:
 
 {% highlight text %}
  symbol   startPrice   topPrice   lastPrice
 ======== ============ ========== ===========
  XYZ      10           13         11
 {% endhighlight %}
 
-The pattern recognition is partitioned by the `symbol` column. Even though not explicitly mentioned
-in the `MEASURES` clause, the partitioned column is added at the beginning of the result.
+该模式识别由 `symbol` 列分区。即使在 `MEASURES` 子句中未明确提及,分区列仍会添加到结果的开头。
 
-Pattern Navigation
+模式导航
 ------------------
 
-The `DEFINE` and `MEASURES` clauses allow for navigating within the list of rows that (potentially)
-match a pattern.
+`DEFINE` 和 `MEASURES` 子句允许在(可能)匹配模式的行列表中进行导航。
 
-This section discusses this navigation for declaring conditions or producing output results.
+本节讨论用于声明条件或产生输出结果的导航。
 
-### Pattern Variable Referencing
+### 引用模式变量
 
-A _pattern variable reference_ allows a set of rows mapped to a particular pattern variable in the
-`DEFINE` or `MEASURES` clauses to be referenced.
+_pattern variable reference_ 允许引用一组映射到 `DEFINE` 或 `MEASURES` 子句中特定模式变量的行。
 
-For example, the expression `A.price` describes a set of rows mapped so far to `A` plus the current
-row if we try to match the current row to `A`. If an expression in the `DEFINE`/`MEASURES` clause
-requires a single row (e.g. `A.price` or `A.price > 10`), it selects the last value belonging to
-the corresponding set.
+如果 `DEFINE`/`MEASURES` 子句中的表达式需要一行(例如`a.price`或`a.price>10`),它将选择属于相应集合的最后一个值。

Review comment:
       ```suggestion
   如果 `DEFINE`/`MEASURES` 子句中的表达式需要一行(例如 `a.price` 或 `a.price>10`),它将选择属于相应集合的最后一个值。
   ```

##########
File path: docs/dev/table/streaming/match_recognize.zh.md
##########
@@ -731,17 +620,15 @@ FIRST(variable.field, n)
 {% endhighlight %}
     </td>
     <td>
-      <p>Returns the value of the field from the event that was mapped to the <i>n</i>-th element
-      of the variable. The counting starts at the first element mapped.</p>
+      <p>返回映射到变量的第<i>n</i>个元素的事件中的字段值。计数从映射的第一个元素开始。</p>

Review comment:
       ```suggestion
         <p>返回映射到变量的第 <i>n</i> 个元素的事件中的字段值。计数从映射的第一个元素开始。</p>
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org