leonardBang commented on a change in pull request #12577:
URL: https://github.com/apache/flink/pull/12577#discussion_r439371384
##########
File path: docs/dev/table/sql/insert.zh.md
##########
@@ -55,27 +75,66 @@ val settings = EnvironmentSettings.newInstance()...
val tEnv = TableEnvironment.create(settings)
// 注册一个 "Orders" 源表,和 "RubberOrders" 结果表
-tEnv.sqlUpdate("CREATE TABLE Orders (`user` BIGINT, product STRING, amount
INT) WITH (...)")
-tEnv.sqlUpdate("CREATE TABLE RubberOrders(product STRING, amount INT) WITH
(...)")
+tEnv.executeSql("CREATE TABLE Orders (`user` BIGINT, product STRING, amount
INT) WITH (...)")
+tEnv.executeSql("CREATE TABLE RubberOrders(product STRING, amount INT) WITH
(...)")
// 运行一个 INSERT 语句,将源表的数据输出到结果表中
Review comment:
运行一条?or unify to `一个` I saw you used `执行一条` above
##########
File path: docs/dev/table/catalogs.zh.md
##########
@@ -100,10 +115,13 @@ Flink SQL> CREATE TABLE mytable (name STRING, age INT)
WITH (...);
Flink SQL> SHOW TABLES;
mytable
{% endhighlight %}
+</div>
+</div>
+
更多详细信息,请参考[Flink SQL CREATE DDL]({{ site.baseurl
}}/zh/dev/table/sql/create.html)。
-### 使用 Java/Scala/Python API
+### 使用 Java/Scala
用户可以用编程的方式使用Java、Scala 或者 Python API 来创建 Catalog 表。
Review comment:
Do we need delete '/Python API' ? the next describe seems use Python API
but not detail tab.
##########
File path: docs/dev/table/sql/explain.zh.md
##########
@@ -0,0 +1,192 @@
+---
+title: "EXPLAIN 语句"
+nav-parent_id: sql
+nav-pos: 2
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+* This will be replaced by the TOC
+{:toc}
+
+EXPLAIN 语句用来解释一个 SELECT 语句或者 DML 的逻辑计划和优化后的计划。
+
+
+## 运行一个 EXPLAIN 语句
+
+EXPLAIN 语句可以通过 `TableEnvironment` 的 `executeSql()` 执行,也可以在 [SQL CLI]({{
site.baseurl }}/zh/dev/table/sqlClient.html) 中执行 EXPLAIN 语句。 若 EXPLAIN
操作执行成功,executeSql() 方法返回解释的结果,否则会抛出异常。
Review comment:
```suggestion
EXPLAIN 语句可以通过 `TableEnvironment` 的 `executeSql()` 执行,也可以在 [SQL CLI]({{
site.baseurl }}/zh/dev/table/sqlClient.html) 中执行 EXPLAIN 语句。 若 EXPLAIN
操作执行成功,`executeSql()` 方法返回解释的结果,否则会抛出异常。
```
##########
File path: docs/dev/table/sql/create.zh.md
##########
@@ -69,38 +69,38 @@ val tableEnv = TableEnvironment.create(settings)
// 对已经已经注册的表进行 SQL 查询
// 注册名为 “Orders” 的表
-tableEnv.sqlUpdate("CREATE TABLE Orders (`user` BIGINT, product STRING, amount
INT) WITH (...)");
+tableEnv.executeSql("CREATE TABLE Orders (`user` BIGINT, product STRING,
amount INT) WITH (...)");
// 在表上执行 SQL 查询,并把得到的结果作为一个新的表
val result = tableEnv.sqlQuery(
"SELECT product, amount FROM Orders WHERE product LIKE '%Rubber%'");
-// SQL 对已注册的表进行 update 操作
+// 对已注册的表进行 INSERT 操作
// 注册 TableSink
-tableEnv.sqlUpdate("CREATE TABLE RubberOrders(product STRING, amount INT) WITH
('connector.path'='/path/to/file' ...)");
-// 在表上执行 SQL 更新查询并向 TableSink 发出结果
-tableEnv.sqlUpdate(
+tableEnv.executeSql("CREATE TABLE RubberOrders(product STRING, amount INT)
WITH ('connector.path'='/path/to/file' ...)");
+// 在表上执行 INSERT 语句并向 TableSink 发出结果
+tableEnv.executeSql(
"INSERT INTO RubberOrders SELECT product, amount FROM Orders WHERE product
LIKE '%Rubber%'")
{% endhighlight %}
</div>
<div data-lang="python" markdown="1">
{% highlight python %}
-settings = EnvironmentSettings.newInstance()...
-table_env = TableEnvironment.create(settings)
+settings = EnvironmentSettings.new_instance()...
+table_env = StreamTableEnvironment.create(env, settings)
# 对已经已经注册的表进行 SQL 查询
Review comment:
对已注册的表进行 SQL 查询
##########
File path: docs/dev/table/sql/insert.zh.md
##########
@@ -40,12 +41,31 @@ EnvironmentSettings settings =
EnvironmentSettings.newInstance()...
TableEnvironment tEnv = TableEnvironment.create(settings);
// 注册一个 "Orders" 源表,和 "RubberOrders" 结果表
-tEnv.sqlUpdate("CREATE TABLE Orders (`user` BIGINT, product VARCHAR, amount
INT) WITH (...)");
-tEnv.sqlUpdate("CREATE TABLE RubberOrders(product VARCHAR, amount INT) WITH
(...)");
+tEnv.executeSql("CREATE TABLE Orders (`user` BIGINT, product VARCHAR, amount
INT) WITH (...)");
+tEnv.executeSql("CREATE TABLE RubberOrders(product VARCHAR, amount INT) WITH
(...)");
// 运行一个 INSERT 语句,将源表的数据输出到结果表中
Review 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.
For queries about this service, please contact Infrastructure at:
[email protected]