wuchong commented on a change in pull request #10738: [FLINK-15385][table][docs] Translate SQL section of Table API into Chinese URL: https://github.com/apache/flink/pull/10738#discussion_r362364507
########## File path: docs/dev/table/sql/create.zh.md ########## @@ -141,44 +141,44 @@ CREATE TABLE [catalog_name.][db_name.]table_name {% endhighlight %} -Creates a table with the given name. If a table with the same name already exists in the catalog, an exception is thrown. +根据给定的表属性创建表。若数据库中已存在同名表会抛出异常。 **COMPUTED COLUMN** -A computed column is a virtual column that is generated using the syntax "`column_name AS computed_column_expression`". It is generated from a non-query expression that uses other columns in the same table and is not physically stored within the table. For example, a computed column could be defined as `cost AS price * quantity`. The expression may contain any combination of physical column, constant, function, or variable. The expression cannot contain a subquery. +计算列是一个使用 “`column_name AS computed_column_expression`” 语法生成的虚拟列。它由使用同一表中其他列的非查询表达式生成,并且不会在表中进行物理存储。例如,一个计算列可以使用 `cost AS price * quantity` 进行定义,这个表达式可以包含物理列、常量、函数或变量的任意组合,但这个表达式不能存在任何子查询。 -Computed columns are commonly used in Flink for defining [time attributes]({{ site.baseurl}}/dev/table/streaming/time_attributes.html) in CREATE TABLE statements. -A [processing time attribute]({{ site.baseurl}}/dev/table/streaming/time_attributes.html#processing-time) can be defined easily via `proc AS PROCTIME()` using the system `PROCTIME()` function. -On the other hand, computed column can be used to derive event time column because an event time column may need to be derived from existing fields, e.g. the original field is not `TIMESTAMP(3)` type or is nested in a JSON string. +在 Flink 中计算列一般用于为 CREATE TABLE 语句定义 [时间属性]({{ site.baseurl}}/zh/dev/table/streaming/time_attributes.html)。 +[处理时间属性]({{ site.baseurl}}/zh/dev/table/streaming/time_attributes.html#processing-time) 可以简单地通过使用了系统函数 `PROCTIME()` 的 `proc AS PROCTIME()` 语句进行定义。 +另一方面,由于事件时间列可能需要从现有的字段中获得,因此计算列可用于获得事件时间列。例如,原始字段的类型不是 `TIMESTAMP(3)` 或嵌套在 JSON 字符串中。 -Notes: +注意: -- A computed column defined on a source table is computed after reading from the source, it can be used in the following SELECT query statements. -- A computed column cannot be the target of an INSERT statement. In INSERT statements, the schema of SELECT clause should match the schema of the target table without computed columns. +- 定义在一个数据源表( source table )上的计算列会在从数据源读取数据后被计算,它们可以在 SELECT 查询语句后使用。 +- 计算列不可以作为 INSERT 语句的目标,在 INSERT 语句中,SELECT 语句的结构( schema )需要与目标表不带有计算列的结构一致。 **WATERMARK** -The `WATERMARK` defines the event time attributes of a table and takes the form `WATERMARK FOR rowtime_column_name AS watermark_strategy_expression`. +`WATERMARK` 定义了表的事件时间属性,其形式为 `WATERMARK FOR rowtime_column_name AS watermark_strategy_expression` 。 -The `rowtime_column_name` defines an existing column that is marked as the event time attribute of the table. The column must be of type `TIMESTAMP(3)` and be a top-level column in the schema. It may be a computed column. +`rowtime_column_name` 把一个现有的列定义为一个为表标记事件时间的属性。该列的类型必须为 `TIMESTAMP(3)`,且是结构中最高级别的列,它也可以是一个计算列。 -The `watermark_strategy_expression` defines the watermark generation strategy. It allows arbitrary non-query expression, including computed columns, to calculate the watermark. The expression return type must be TIMESTAMP(3), which represents the timestamp since the Epoch. +`watermark_strategy_expression` 定义了 watermark 的生成策略。它允许使用包括计算列在内的任意非查询表达式来计算 watermark ;表达式的返回类型必须是表示了从起始点( Epoch )以来的时间戳的 TIMESTAMP(3) 。 -When using event time semantics, tables must contain an event time attribute and watermarking strategy. +使用事件时间语义时,表必须包含事件时间属性和 watermark 策略。 -Flink provides several commonly used watermark strategies. +Flink 提供了几种常用的 watermark 策略。 -- Strictly ascending timestamps: `WATERMARK FOR rowtime_column AS rowtime_column`. +- 严格递增时间戳: `WATERMARK FOR rowtime_column AS rowtime_column`。 - Emits a watermark of the maximum observed timestamp so far. Rows that have a timestamp smaller to the max timestamp are not late. + 发出到目前为止已观察到的最大时间戳的 watermark ,时间戳小于最大时间戳的行不会迟到。 Review comment: ```suggestion 发出到目前为止已观察到的最大时间戳的 watermark ,时间戳小于最大时间戳的行被认为没有迟到。 ``` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services