healchow commented on code in PR #21726:
URL: https://github.com/apache/flink/pull/21726#discussion_r1081453260


##########
docs/content.zh/docs/dev/table/sql/queries/overview.md:
##########
@@ -155,110 +158,116 @@ sink_descriptor = 
TableDescriptor.for_connector("filesystem")
 
 t_env.create_temporary_table("RubberOrders", sink_descriptor)
 
-# run an INSERT SQL on the Table and emit the result to the TableSink
+# 在表上执行一个 INSERT SQL ,SQL结果写入到TableSink
 table_env \
     .execute_sql("INSERT INTO RubberOrders SELECT product, amount FROM Orders 
WHERE product LIKE '%Rubber%'")
 ```
+
 {{< /tab >}}
 {{< /tabs >}}
 
 {{< top >}}
 
-## Execute a Query
+## 执行查询
 
+通过`TableEnvironment.executeSql()`方法可以执行`SELECT`或`VALUES`语句,并把结果收集到本地.它将`SELECT`语句(或`VALUES`语句)的结果作为`TableResult`返回.和`SELECT`语句相似,`Table.execute()`方法可以执行`Table`对象,并把结果收集到本地客户端.
+`TableResult.collect()`方法返回一个可关闭的行迭代器(row 
iterator).除非所有结果数据都被收集完成了,否则`SELECT`作业不会停止,所以应该积极使用`CloseableIterator#close()`方法关闭作业,以防止资源泄露.
 
`TableResult.print()`可以打印`SELECT`的结果到客户端的控制台中.`TableResult`上的结果数据只能被访问一次.因此`collect()`和`print()`只能二选一.
 
-A SELECT statement or a VALUES statement can be executed to collect the 
content to local through the `TableEnvironment.executeSql()` method. The method 
returns the result of the SELECT statement (or the VALUES statement) as a 
`TableResult`. Similar to a SELECT statement, a `Table` object can be executed 
using the `Table.execute()` method to collect the content of the query to the 
local client.
-`TableResult.collect()` method returns a closeable row iterator. The select 
job will not be finished unless all result data has been collected. We should 
actively close the job to avoid resource leak through the 
`CloseableIterator#close()` method. 
-We can also print the select result to client console through the 
`TableResult.print()` method. The result data in `TableResult` can be accessed 
only once. Thus, `collect()` and `print()` must not be called after each other.
+`TableResult.collect()` 和 
`TableResult.print()`在不同的checkpointing设置下有一些差异.(流式作业开启checkpointing, 参见 
\[checkpointing 设置]\({{< ref "docs/deployment/config" >}}#checkpointing)).
 
-`TableResult.collect()` and `TableResult.print()` have slightly different 
behaviors under different checkpointing settings (to enable checkpointing for a 
streaming job, see [checkpointing config]({{< ref "docs/deployment/config" 
>}}#checkpointing)).
-* For batch jobs or streaming jobs without checkpointing, 
`TableResult.collect()` and `TableResult.print()` have neither exactly-once nor 
at-least-once guarantee. Query results are immediately accessible by the 
clients once they're produced, but exceptions will be thrown when the job fails 
and restarts.
-* For streaming jobs with exactly-once checkpointing, `TableResult.collect()` 
and `TableResult.print()` guarantee an end-to-end exactly-once record delivery. 
A result will be accessible by clients only after its corresponding checkpoint 
completes.
-* For streaming jobs with at-least-once checkpointing, `TableResult.collect()` 
and `TableResult.print()` guarantee an end-to-end at-least-once record 
delivery. Query results are immediately accessible by the clients once they're 
produced, but it is possible for the same result to be delivered multiple times.
+*   对于没有checkpointing的批式或流式作业, `TableResult.collect()` 和 `TableResult.print()` 
既不保证精确一次(exactly-once)也不保证至少一次(at-least-once) 
.查询结果一旦产生,客户端可以立即访问,但是,作业失败或重启将抛出异常.
+*   对于checkpointing设置为精确一次(exactly-once)的流式作业, `TableResult.collect()` 和 
`TableResult.print()` 保证端到端(end-to-end)的数据只传递一次.相应的checkpoint完成后,客户端才能访问结果.
+*   对于checkpointing设置为至少一次(at-least-once)的流式作业, `TableResult.collect()` 和 
`TableResult.print()` 保证端到端(end-to-end)的数据至少传递一次. 
查询结果一旦产生,客户端可以立即访问,但是可能会有同一条数据出现多次的情况.
 
 {{< tabs "88a003e1-16ea-43cc-9d42-d43ef1351e53" >}}
 {{< tab "Java" >}}
+
 ```java
 StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
 StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, settings);
 
 tableEnv.executeSql("CREATE TABLE Orders (`user` BIGINT, product STRING, 
amount INT) WITH (...)");
 
-// execute SELECT statement
+// 执行`SELECT`语句
 TableResult tableResult1 = tableEnv.executeSql("SELECT * FROM Orders");
-// use try-with-resources statement to make sure the iterator will be closed 
automatically
+// 使用 try-with-resources 确保iterator会自动关闭
 try (CloseableIterator<Row> it = tableResult1.collect()) {
     while(it.hasNext()) {
         Row row = it.next();
-        // handle row
+        // 处理数据
     }
 }
 
-// execute Table
+// 执行表
 TableResult tableResult2 = tableEnv.sqlQuery("SELECT * FROM Orders").execute();
 tableResult2.print();
 
 ```
+
 {{< /tab >}}
 {{< tab "Scala" >}}
+
 ```scala
 val env = StreamExecutionEnvironment.getExecutionEnvironment()
 val tableEnv = StreamTableEnvironment.create(env, settings)
-// enable checkpointing
+// 启用 checkpointing
 tableEnv.getConfig
   .set(ExecutionCheckpointingOptions.CHECKPOINTING_MODE, 
CheckpointingMode.EXACTLY_ONCE)
 tableEnv.getConfig
   .set(ExecutionCheckpointingOptions.CHECKPOINTING_INTERVAL, 
Duration.ofSeconds(10))
 
 tableEnv.executeSql("CREATE TABLE Orders (`user` BIGINT, product STRING, 
amount INT) WITH (...)")
 
-// execute SELECT statement
+// 执行`SELECT`语句

Review Comment:
   It is not recommended to translate the code comment.



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to