klion26 commented on a change in pull request #12313:
URL: https://github.com/apache/flink/pull/12313#discussion_r430865901
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -208,14 +215,14 @@ CREATE TABLE Orders (
**注意:** 使用 `CREATE TABLE` 语句注册的表均可用作 table source 和 table sink。 在被 DML
语句引用前,我们无法决定其实际用于 source 抑或是 sink。
-**LIKE clause**
+**LIKE**
+
+`LIKE` 子句来源于两种 SQL 特性的变体/组合(Feature T171,“表定义中的LIKE语法” 和 Feature
T173,“表定义中的LIKE语法扩展”)。LIKE 子句可以基于现有表的定义去创建新表,并且可以扩展或排除原始表中的某些部分。与 SQL 标准相反,LIKE
子句必须在 CREATE 语句中定义。这是因为 LIKE 子句可以应用于表定义的多个部分,而不仅仅是 schema 部分。
Review comment:
```suggestion
`LIKE` 子句来源于两种 SQL 特性的变体/组合(Feature T171,“表定义中的 LIKE 语法” 和 Feature
T173,“表定义中的 LIKE 语法扩展”)。LIKE 子句可以基于现有表的定义去创建新表,并且可以扩展或排除原始表中的某些部分。与 SQL
标准相反,LIKE 子句必须在 CREATE 语句中定义。这是因为 LIKE 子句可以应用于表定义的多个部分,而不仅仅是 schema 部分。
```
另外这里的实现细节我不是太清楚,但是从字面上看 “at the top-level of a CREATE statement" 这里翻译成”必须在
CREATE 语句中定义“,我比较好奇这里说的 ”top-level“ 是指什么意思呢?
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -208,14 +215,14 @@ CREATE TABLE Orders (
**注意:** 使用 `CREATE TABLE` 语句注册的表均可用作 table source 和 table sink。 在被 DML
语句引用前,我们无法决定其实际用于 source 抑或是 sink。
-**LIKE clause**
+**LIKE**
Review comment:
这里单纯的用 `LIKE` 会觉的不太完整
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -249,59 +257,60 @@ CREATE TABLE Orders_with_watermark (
);
{% endhighlight %}
-The merging logic of table features can be controlled with `like options`.
+表属性的合并逻辑可以用 `like options` 来控制。
-You can control the merging behavior of:
+可以控制合并的表属性如下:
-* CONSTRAINTS - constraints such as primary and unique keys
-* GENERATED - computed columns
-* OPTIONS - connector options that describe connector and format properties
-* PARTITIONS - partition of the tables
-* WATERMARKS - watermark declarations
+* CONSTRAINTS - 主键和唯一键约束
+* GENERATED - 计算列
+* OPTIONS - 连接器和格式化的配置项
+* PARTITIONS - 表分区信息
+* WATERMARKS - watermark 定义
-with three different merging strategies:
+并且有三种不同的表属性合并策略:
-* INCLUDING - Includes the feature of the source table, fails on duplicate
entries, e.g. if an option with the same key exists in both tables.
-* EXCLUDING - Does not include the given feature of the source table.
-* OVERWRITING - Includes the feature of the source table, overwrites duplicate
entries of the source table with properties of the new table, e.g. if an option
with the same key exists in both tables, the one from the current statement
will be used.
+* INCLUDING - 新表包含源表(source table)所有的表属性,如果和源表的表属性重复则会直接失败,例如新表和源表存在相同 key 的属性。
+* EXCLUDING - 新表不包含源表指定的任何表属性。
+* OVERWRITING - 新表包含源表的表属性,但如果出现重复项,则会用新表的表属性覆盖源表中的重复表属性,例如,两个表中都存在相同 key
的属性,则会使用当前语句中定义的 key 的属性值。
-Additionally, you can use the `INCLUDING/EXCLUDING ALL` option to specify what
should be the strategy if there was no specific strategy defined, i.e. if you
use `EXCLUDING ALL INCLUDING WATERMARKS` only the watermarks will be included
from the source table.
+此外,如果没有特别指定合并策略,也可以使用 `INCLUDING/EXCLUDING ALL` 这种声明方式来指定使用怎样的合并策略,例如使用
`EXCLUDING ALL INCLUDING WATERMARKS`,那么代表只有源表的 WATERMARKS 属性才会被包含进新表。
-Example:
+示例如下:
{% highlight sql %}
--- A source table stored in a filesystem
+
+-- 存储在文件系统的源表
CREATE TABLE Orders_in_file (
user BIGINT,
product STRING,
order_time_string STRING,
order_time AS to_timestamp(order_time)
-
+
)
PARTITIONED BY user
WITH (
'connector' = 'filesystem'
'path' = '...'
);
--- A corresponding table we want to store in kafka
+-- 对应存储在 kafka 的源表
CREATE TABLE Orders_in_kafka (
- -- Add watermark definition
+ -- 添加 watermark 定义
WATERMARK FOR order_time AS order_time - INTERVAL '5' SECOND
) WITH (
'connector': 'kafka'
...
)
LIKE Orders_in_file (
- -- Exclude everything besides the computed columns which we need to
generate the watermark for.
- -- We do not want to have the partitions or filesystem options as those do
not apply to kafka.
+ -- 排除需要生成 watermark 的计算列之外的所有内容。
+ -- 去除不适用于 kafka 的所有分区和文件系统的相关属性。
EXCLUDING ALL
INCLUDING GENERATED
);
{% endhighlight %}
-If you provide no like options, `INCLUDING ALL OVERWRITING OPTIONS` will be
used as a default.
+如果未提供 like 配置项(like options),默认将使用 `INCLUDING ALL OVERWRITING OPTIONS` 的合并策略。
-**NOTE** You cannot control the behavior of merging physical fields. Those
will be merged as if you applied the `INCLUDING` strategy.
+**注意:** 您无法选择物理列的合并策略,当物理列进行合并时就如使用了 `INCLUDING` 策略。
Review comment:
这个有个小疑问,`physical fields` 就是指物理列吗?这个是和 逻辑列 对应的吗?另外在网上搜索发现 “物理列”这个描述好少
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -249,59 +257,60 @@ CREATE TABLE Orders_with_watermark (
);
{% endhighlight %}
-The merging logic of table features can be controlled with `like options`.
+表属性的合并逻辑可以用 `like options` 来控制。
-You can control the merging behavior of:
+可以控制合并的表属性如下:
-* CONSTRAINTS - constraints such as primary and unique keys
-* GENERATED - computed columns
-* OPTIONS - connector options that describe connector and format properties
-* PARTITIONS - partition of the tables
-* WATERMARKS - watermark declarations
+* CONSTRAINTS - 主键和唯一键约束
+* GENERATED - 计算列
+* OPTIONS - 连接器和格式化的配置项
Review comment:
这里 `format properties` 翻译成 `格式化的配置项` 整句话连起来有点像 “`连接器` 和 `格式化的配置项`”
有什么办法可以改进一下吗
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -249,59 +257,60 @@ CREATE TABLE Orders_with_watermark (
);
{% endhighlight %}
-The merging logic of table features can be controlled with `like options`.
+表属性的合并逻辑可以用 `like options` 来控制。
-You can control the merging behavior of:
+可以控制合并的表属性如下:
-* CONSTRAINTS - constraints such as primary and unique keys
-* GENERATED - computed columns
-* OPTIONS - connector options that describe connector and format properties
-* PARTITIONS - partition of the tables
-* WATERMARKS - watermark declarations
+* CONSTRAINTS - 主键和唯一键约束
+* GENERATED - 计算列
+* OPTIONS - 连接器和格式化的配置项
+* PARTITIONS - 表分区信息
+* WATERMARKS - watermark 定义
-with three different merging strategies:
+并且有三种不同的表属性合并策略:
-* INCLUDING - Includes the feature of the source table, fails on duplicate
entries, e.g. if an option with the same key exists in both tables.
-* EXCLUDING - Does not include the given feature of the source table.
-* OVERWRITING - Includes the feature of the source table, overwrites duplicate
entries of the source table with properties of the new table, e.g. if an option
with the same key exists in both tables, the one from the current statement
will be used.
+* INCLUDING - 新表包含源表(source table)所有的表属性,如果和源表的表属性重复则会直接失败,例如新表和源表存在相同 key 的属性。
+* EXCLUDING - 新表不包含源表指定的任何表属性。
+* OVERWRITING - 新表包含源表的表属性,但如果出现重复项,则会用新表的表属性覆盖源表中的重复表属性,例如,两个表中都存在相同 key
的属性,则会使用当前语句中定义的 key 的属性值。
-Additionally, you can use the `INCLUDING/EXCLUDING ALL` option to specify what
should be the strategy if there was no specific strategy defined, i.e. if you
use `EXCLUDING ALL INCLUDING WATERMARKS` only the watermarks will be included
from the source table.
+此外,如果没有特别指定合并策略,也可以使用 `INCLUDING/EXCLUDING ALL` 这种声明方式来指定使用怎样的合并策略,例如使用
`EXCLUDING ALL INCLUDING WATERMARKS`,那么代表只有源表的 WATERMARKS 属性才会被包含进新表。
Review comment:
这里的意思是不是说没有一些 “defined” 的策略,那么就可以用 `INCLUDING/EXCLUDING ALL`
类似的语法来描述,就像后面的例子一样。
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -208,14 +215,14 @@ CREATE TABLE Orders (
**注意:** 使用 `CREATE TABLE` 语句注册的表均可用作 table source 和 table sink。 在被 DML
语句引用前,我们无法决定其实际用于 source 抑或是 sink。
-**LIKE clause**
+**LIKE**
+
+`LIKE` 子句来源于两种 SQL 特性的变体/组合(Feature T171,“表定义中的LIKE语法” 和 Feature
T173,“表定义中的LIKE语法扩展”)。LIKE 子句可以基于现有表的定义去创建新表,并且可以扩展或排除原始表中的某些部分。与 SQL 标准相反,LIKE
子句必须在 CREATE 语句中定义。这是因为 LIKE 子句可以应用于表定义的多个部分,而不仅仅是 schema 部分。
-The `LIKE` clause is a variant/combination of SQL features (Feature T171,
“LIKE clause in table definition” and Feature T173, “Extended LIKE clause in
table definition”). The clause can be used to create a table based on a
definition of an existing table. Additionally, users
-can extend the original table or exclude certain parts of it. In contrast to
the SQL standard the clause must be defined at the top-level of a CREATE
statement. That is because the clause applies to multiple parts of the
definition and not only to the schema part.
+你可以使用该子句,重用(或覆写)指定的连接器配置属性或者可以向外部表添加 watermark 定义,例如可以向 Apache Hive 中定义的表添加
watermark 定义。
Review comment:
个人意见:`覆写` 更像是繁体中文中的描述,这里如果用 `改写` 会好一些吗?(这里修改的话,其他地方也需要同步修改)
后面这句话的意思是不是说 “可以向哪些从 Apache Hive 读取的表增加 watermark”? 也就是说从 Hive
读取的,但是仅读取可能是没有 watermark 的,这里就可以增加 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:
[email protected]