luoyuxia commented on code in PR #23116:
URL: https://github.com/apache/flink/pull/23116#discussion_r1284307429


##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。
+
+#### 原子性
+
+如果要启用 CTAS 的原子性,则应确保:
+* Sink 已经实现了 CTAS 的原子性语义。通过阅读 Sink 的文档可以知道其是否已经支持了原子性语义。如果开发者想要实现原子性语义,请参考文档 
[SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" >}}#sink-abilities)。

Review Comment:
   ```suggestion
   * 对应的 Connector sink 已经实现了 CTAS 的原子性语义,你可能需要阅读对应 Connector 
的文档看是否已经支持了原子性语义。如果开发者想要实现原子性语义,请参考文档 [SupportsStaging]({{< ref 
"docs/dev/table/sourcesSinks" >}}#sink-abilities)。
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。
+
+#### 原子性
+
+如果要启用 CTAS 的原子性,则应确保:
+* Sink 已经实现了 CTAS 的原子性语义。通过阅读 Sink 的文档可以知道其是否已经支持了原子性语义。如果开发者想要实现原子性语义,请参考文档 
[SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" >}}#sink-abilities)。
+* 设置配置项 `table.rtas-ctas.atomicity-enabled` 为 `true`。

Review Comment:
   Add a link for `table.rtas-ctas.atomicity-enabled`



##########
docs/content/docs/dev/table/sourcesSinks.md:
##########
@@ -344,6 +344,11 @@ that a sink can still work on common data structures and 
perform a conversion at
         and consuming them to achieve the purpose of row(s) update.
         </td>
     </tr>
+    <tr>
+        <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsStaging.java"
 name="SupportsStaging" >}}</td>
+        <td>Enables to supports atomic semantic for CTAS or RTAS in a 
<code>DynamicTableSink</code>. The table sink is responsible for return 
`StagedTable` object that provide atomic semantics.

Review Comment:
   ```suggestion
           <td>Enables to support atomic semantic for CTAS(CREATE TABLE AS) or 
RTAS([CREATE OR] REPLACE TABLE AS SELECT) in a <code>DynamicTableSink</code>. 
The table sink is responsible for returning <code>StagedTable</code> object 
that provide atomic semantics.
   ```



##########
docs/content.zh/docs/dev/table/sourcesSinks.md:
##########
@@ -268,15 +268,19 @@ Flink 会对工厂类逐个进行检查,确保其“标识符”是全局唯
     </tr>
     <tr>
         <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsDeletePushDown.java"
 name="SupportsDeletePushDown" >}}</td>
-        <td>支持将 <code>DELETE</code> 语句中的过滤条件下推到 
<code>DynamicTableSink</code>,sink 端可以直接根据过滤条件来删除数据。
+        <td>支持将 <code>DELETE</code> 语句中的过滤条件下推到 
<code>DynamicTableSink</code>,sink 端可以直接根据过滤条件来删除数据。</td>
     </tr>
     <tr>
         <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsRowLevelDelete.java"
 name="SupportsRowLevelDelete" >}}</td>
-        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来删除已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到删除数据的目的。
+        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来删除已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到删除数据的目的。</td>
     </tr>
     <tr>
         <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsRowLevelUpdate.java"
 name="SupportsRowLevelUpdate" >}}</td>
-        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来更新已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到更新数据的目的。
+        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来更新已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到更新数据的目的。</td>
+    </tr>
+    <tr>
+        <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsStaging.java"
 name="SupportsStaging" >}}</td>
+        <td>支持 <code>DynamicTableSink</code> 提供 CTAS 或 RTAS 
的原子性语义。该接口的实现者需要返回一个提供原子性语义实现的 `StagedTable` 对象。</td>

Review Comment:
   ```suggestion
           <td>支持 <code>DynamicTableSink</code> 提供 CTAS(CREATE TABLE AS) 或 
RTAS([CREATE OR] REPLACE TABLE AS SELECT) 的原子性语义。该接口的实现者需要返回一个提供原子性语义实现的 
<code>StagedTable</code> 对象。</td>
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -608,6 +614,14 @@ INSERT INTO my_rtas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
+**注意** 默认情况下,RTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除或还原成原来的表。

Review Comment:
   nit
   ```suggestion
   **注意:** 默认情况下,RTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除或还原成原来的表。
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。

Review Comment:
   nit
   ```suggestion
   **注意:** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。
   ```



##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -609,6 +615,14 @@ INSERT INTO my_rtas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * Does not support creating partitioned table yet.
 * Does not support specifying primary key constraints yet.
 
+**Note** By default, RTAS is non-atomic which means the table won't be dropped 
or restored to its origin automatically if occur errors while inserting data 
into the table.
+
+### Atomicity
+
+If you want to enable atomicity for RTAS, then you should make sure:
+* The sink has implemented the atomicity semantics for RTAS. You may refer to 
the corresponding doc for the sink to know the atomicity semantics is available 
or not. For devs who want to implement the atomicity semantics, please refer to 
doc [SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" >}}#sink-abilities).
+* Set option `table.rtas-ctas.atomicity-enabled` to `true`.

Review Comment:
   Add a link.



##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * Does not support creating partitioned table yet.
 * Does not support specifying primary key constraints yet.
 
-**Note** The target table created by CTAS is non-atomic currently, the table 
won't be dropped automatically if occur errors while inserting data into the 
table.
+**Note** By default, CTAS is non-atomic which means the table created won't be 
dropped automatically if occur errors while inserting data into the table.

Review Comment:
   ```suggestion
   **Note:** By default, CTAS is non-atomic which means the table created won't 
be dropped automatically if occur errors while inserting data into the table.
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。

Review Comment:
   Also, please don't forget to update all from `**注意**` to `**注意:**` in 
CTAS/RTAS part in the doc



##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -609,6 +615,14 @@ INSERT INTO my_rtas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * Does not support creating partitioned table yet.
 * Does not support specifying primary key constraints yet.
 
+**Note** By default, RTAS is non-atomic which means the table won't be dropped 
or restored to its origin automatically if occur errors while inserting data 
into the table.
+
+### Atomicity
+
+If you want to enable atomicity for RTAS, then you should make sure:
+* The sink has implemented the atomicity semantics for RTAS. You may refer to 
the corresponding doc for the sink to know the atomicity semantics is available 
or not. For devs who want to implement the atomicity semantics, please refer to 
doc [SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" >}}#sink-abilities).

Review Comment:
   dito



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。
+
+#### 原子性
+
+如果要启用 CTAS 的原子性,则应确保:
+* Sink 已经实现了 CTAS 的原子性语义。通过阅读 Sink 的文档可以知道其是否已经支持了原子性语义。如果开发者想要实现原子性语义,请参考文档 
[SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" >}}#sink-abilities)。

Review Comment:
   ```suggestion
   * 对应的 Connector sink 已经实现了 CTAS 的原子性语义,你可能需要阅读对应 Connector 
的文档看是否已经支持了原子性语义。如果开发者想要实现原子性语义,请参考文档 [SupportsStaging]({{< ref 
"docs/dev/table/sourcesSinks" >}}#sink-abilities)。
   ```



##########
docs/content.zh/docs/dev/table/sourcesSinks.md:
##########
@@ -268,15 +268,19 @@ Flink 会对工厂类逐个进行检查,确保其“标识符”是全局唯
     </tr>
     <tr>
         <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsDeletePushDown.java"
 name="SupportsDeletePushDown" >}}</td>
-        <td>支持将 <code>DELETE</code> 语句中的过滤条件下推到 
<code>DynamicTableSink</code>,sink 端可以直接根据过滤条件来删除数据。
+        <td>支持将 <code>DELETE</code> 语句中的过滤条件下推到 
<code>DynamicTableSink</code>,sink 端可以直接根据过滤条件来删除数据。</td>
     </tr>
     <tr>
         <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsRowLevelDelete.java"
 name="SupportsRowLevelDelete" >}}</td>
-        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来删除已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到删除数据的目的。
+        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来删除已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到删除数据的目的。</td>
     </tr>
     <tr>
         <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsRowLevelUpdate.java"
 name="SupportsRowLevelUpdate" >}}</td>
-        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来更新已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到更新数据的目的。
+        <td>支持 <code>DynamicTableSink</code> 根据行级别的变更来更新已有的数据。该接口的实现者需要告诉 
Planner 如何产生这些行变更,并且需要消费这些行变更从而达到更新数据的目的。</td>
+    </tr>
+    <tr>
+        <td>{{< gh_link 
file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/sink/abilities/SupportsStaging.java"
 name="SupportsStaging" >}}</td>
+        <td>支持 <code>DynamicTableSink</code> 提供 CTAS 或 RTAS 
的原子性语义。该接口的实现者需要返回一个提供原子性语义实现的 `StagedTable` 对象。</td>

Review Comment:
   ```suggestion
           <td>支持 <code>DynamicTableSink</code> 提供 CTAS(CREATE TABLE AS) 或 
RTAS([CREATE OR] REPLACE TABLE AS SELECT) 的原子性语义。该接口的实现者需要返回一个提供原子性语义实现的 
<code>StagedTable</code> 对象。</td>
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -608,6 +614,14 @@ INSERT INTO my_rtas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
+**注意** 默认情况下,RTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除或还原成原来的表。

Review Comment:
   nit
   ```suggestion
   **注意:** 默认情况下,RTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除或还原成原来的表。
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。

Review Comment:
   nit
   ```suggestion
   **注意:** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。
   ```



##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -609,6 +615,14 @@ INSERT INTO my_rtas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * Does not support creating partitioned table yet.
 * Does not support specifying primary key constraints yet.
 
+**Note** By default, RTAS is non-atomic which means the table won't be dropped 
or restored to its origin automatically if occur errors while inserting data 
into the table.

Review Comment:
   ```suggestion
   **Note:** By default, RTAS is non-atomic which means the table won't be 
dropped or restored to its origin automatically if occur errors while inserting 
data into the table.
   ```



##########
docs/content/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * Does not support creating partitioned table yet.
 * Does not support specifying primary key constraints yet.
 
-**Note** The target table created by CTAS is non-atomic currently, the table 
won't be dropped automatically if occur errors while inserting data into the 
table.
+**Note** By default, CTAS is non-atomic which means the table created won't be 
dropped automatically if occur errors while inserting data into the table.
+
+#### Atomicity
+
+If you want to enable atomicity for CTAS, then you should make sure:
+* The sink has implemented the atomicity semantics for CTAS. You may refer to 
the corresponding doc for the sink to know the atomicity semantics is available 
or not. For devs who want to implement the atomicity semantics, please refer to 
doc [SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" >}}#sink-abilities).

Review Comment:
   ```suggestion
   * The sink has implemented the atomicity semantics for CTAS. You may refer 
to the doc for the corresponding connector sink to know the atomicity semantics 
is available or not. For devs who want to implement the atomicity semantics, 
please refer to the doc [SupportsStaging]({{< ref "docs/dev/table/sourcesSinks" 
>}}#sink-abilities).
   ```



##########
docs/content.zh/docs/dev/table/sql/create.md:
##########
@@ -554,7 +554,13 @@ INSERT INTO my_ctas_table SELECT id, name, age FROM 
source_table WHERE mod(id, 1
 * 暂不支持创建分区表。
 * 暂不支持主键约束。
 
-**注意** 目前,CTAS 创建的目标表是非原子性的,如果在向表中插入数据时发生错误,该表不会被自动删除。
+**注意** 默认情况下,CTAS 是非原子性的,这意味着如果在向表中插入数据时发生错误,该表不会被自动删除。

Review Comment:
   Also, please don't forget to update all from `**注意**` to `**注意:**` in 
CTAS/RTAS part in the doc



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to