leonardBang commented on a change in pull request #16051:
URL: https://github.com/apache/flink/pull/16051#discussion_r664474025



##########
File path: docs/content.zh/docs/dev/table/sql/explain.md
##########
@@ -30,6 +30,7 @@ under the License.
 
 EXPLAIN statements are used to explain the logical and optimized query plans 
of a query or an INSERT statement.
 
+

Review comment:
       revert the unnecessary  change

##########
File path: docs/content.zh/docs/dev/table/sql/explain.md
##########
@@ -138,52 +153,144 @@ table_result = t_env.execute_sql(
     "SELECT `count`, word FROM MyTable2")
 table_result.print()
 
+table_result2 = t_env.execute_sql(
+    "EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN "
+    "SELECT `count`, word FROM MyTable1 WHERE word LIKE 'F%' "
+    "UNION ALL "
+    "SELECT `count`, word FROM MyTable2")
+table_result2.print()
+
 ```
 {{< /tab >}}
 {{< tab "SQL CLI" >}}
+
 ```sql
-Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
-Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
 Flink SQL> EXPLAIN PLAN FOR SELECT `count`, word FROM MyTable1 WHERE word LIKE 
'F%' 
 > UNION ALL 
 > SELECT `count`, word FROM MyTable2;
-
+                                  
+Flink SQL> EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN SELECT 
`count`, word FROM MyTable1 
+> WHERE word LIKE 'F%' 
+> UNION ALL 
+> SELECT `count`, word FROM MyTable2;
 ```
 {{< /tab >}}
 {{< /tabs >}}
 
 The `EXPLAIN` result is:
+
+{{< tabs "explain result" >}}
+
+{{< tab "PLAN FOR" >}}
+
 ```text
 == Abstract Syntax Tree ==
 LogicalUnion(all=[true])
-  LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
-    LogicalTableScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  LogicalTableScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
 
 == Optimized Physical Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
 
 == Optimized Execution Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
 ```
 
+{{< /tab >}}
+
+{{< tab "EXPLAINDETAILS" >}}
+
+```text
+== Abstract Syntax Tree ==
+LogicalUnion(all=[true])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
+
+== Optimized Physical Plan ==
+Union(all=[true], union=[count, word], changelogMode=[I]): rowcount = 1.05E8, 
cumulative cost = {3.1E8 rows, 3.05E8 cpu, 4.0E9 io, 0.0 network, 0.0 memory}
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')], 
changelogMode=[I]): rowcount = 5000000.0, cumulative cost = {1.05E8 rows, 1.0E8 
cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+
+== Optimized Execution Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Physical Execution Plan ==
+{
+  "nodes" : [ {
+    "id" : 37,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "parallelism" : 1
+  }, {
+    "id" : 38,
+    "type" : "Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])",
+    "pact" : "Operator",
+    "contents" : "Calc(select=[count, word], where=[LIKE(word, 
_UTF-16LE'F%')])",
+    "parallelism" : 1,
+    "predecessors" : [ {
+      "id" : 37,
+      "ship_strategy" : "FORWARD",
+      "side" : "second"
+    } ]
+  }, {
+    "id" : 39,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "parallelism" : 1
+  } ]
+```
+
+{{< /tab >}}
+
+{{< /tabs >}}
+
 {{< top >}}
 
+## ExplainDetails
+```sql

Review comment:
       The quoted content is not SQL

##########
File path: docs/content.zh/docs/dev/table/sql/explain.md
##########
@@ -138,52 +153,144 @@ table_result = t_env.execute_sql(
     "SELECT `count`, word FROM MyTable2")
 table_result.print()
 
+table_result2 = t_env.execute_sql(
+    "EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN "
+    "SELECT `count`, word FROM MyTable1 WHERE word LIKE 'F%' "
+    "UNION ALL "
+    "SELECT `count`, word FROM MyTable2")
+table_result2.print()
+
 ```
 {{< /tab >}}
 {{< tab "SQL CLI" >}}
+
 ```sql
-Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
-Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
 Flink SQL> EXPLAIN PLAN FOR SELECT `count`, word FROM MyTable1 WHERE word LIKE 
'F%' 
 > UNION ALL 
 > SELECT `count`, word FROM MyTable2;
-
+                                  
+Flink SQL> EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN SELECT 
`count`, word FROM MyTable1 
+> WHERE word LIKE 'F%' 
+> UNION ALL 
+> SELECT `count`, word FROM MyTable2;
 ```
 {{< /tab >}}
 {{< /tabs >}}
 
 The `EXPLAIN` result is:
+
+{{< tabs "explain result" >}}
+
+{{< tab "PLAN FOR" >}}
+
 ```text
 == Abstract Syntax Tree ==
 LogicalUnion(all=[true])
-  LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
-    LogicalTableScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  LogicalTableScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
 
 == Optimized Physical Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
 
 == Optimized Execution Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
 ```
 
+{{< /tab >}}
+
+{{< tab "EXPLAINDETAILS" >}}
+
+```text
+== Abstract Syntax Tree ==
+LogicalUnion(all=[true])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
+
+== Optimized Physical Plan ==
+Union(all=[true], union=[count, word], changelogMode=[I]): rowcount = 1.05E8, 
cumulative cost = {3.1E8 rows, 3.05E8 cpu, 4.0E9 io, 0.0 network, 0.0 memory}
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')], 
changelogMode=[I]): rowcount = 5000000.0, cumulative cost = {1.05E8 rows, 1.0E8 
cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+
+== Optimized Execution Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Physical Execution Plan ==
+{
+  "nodes" : [ {
+    "id" : 37,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "parallelism" : 1
+  }, {
+    "id" : 38,
+    "type" : "Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])",
+    "pact" : "Operator",
+    "contents" : "Calc(select=[count, word], where=[LIKE(word, 
_UTF-16LE'F%')])",
+    "parallelism" : 1,
+    "predecessors" : [ {
+      "id" : 37,
+      "ship_strategy" : "FORWARD",
+      "side" : "second"
+    } ]
+  }, {
+    "id" : 39,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "parallelism" : 1
+  } ]
+```
+
+{{< /tab >}}
+
+{{< /tabs >}}
+
 {{< top >}}
 
+## ExplainDetails
+```sql
+Print the plan for the statement with specified ExplainDetails.
+
+ESTIMATED_COST: generates cost information on physical node estimated by 
optimizer, 
+e.g. TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 
0.0 network, 0.0 memory})
+
+CHANGELOG_MODE:generates changelog mode for every physical rel node. 
+e.g. GroupAggregate(..., changelogMode=[I,UA,D])
+
+JSON_EXECUTION_PLAN: generates the execution plan in json format of the 
program.
+```
+
+

Review comment:
       useless

##########
File path: docs/content/docs/dev/table/sql/explain.md
##########
@@ -139,52 +153,144 @@ table_result = t_env.execute_sql(
     "SELECT `count`, word FROM MyTable2")
 table_result.print()
 
+table_result2 = t_env.execute_sql(
+    "EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN "
+    "SELECT `count`, word FROM MyTable1 WHERE word LIKE 'F%' "
+    "UNION ALL "
+    "SELECT `count`, word FROM MyTable2")
+table_result2.print()
+
 ```
 {{< /tab >}}
 {{< tab "SQL CLI" >}}
+
 ```sql
-Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
-Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
 Flink SQL> EXPLAIN PLAN FOR SELECT `count`, word FROM MyTable1 WHERE word LIKE 
'F%' 
 > UNION ALL 
 > SELECT `count`, word FROM MyTable2;
-
+                                  
+Flink SQL> EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN SELECT 
`count`, word FROM MyTable1 
+> WHERE word LIKE 'F%' 
+> UNION ALL 
+> SELECT `count`, word FROM MyTable2;
 ```
 {{< /tab >}}
 {{< /tabs >}}
 
 The `EXPLAIN` result is:
+
+{{< tabs "explain result" >}}
+
+{{< tab "PLAN FOR" >}}
+
+```text
+== Abstract Syntax Tree ==
+LogicalUnion(all=[true])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
+
+== Optimized Physical Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Optimized Execution Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+```
+
+{{< /tab >}}
+
+{{< tab "EXPLAINDETAILS" >}}
+
 ```text
 == Abstract Syntax Tree ==
 LogicalUnion(all=[true])
-  LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
-    LogicalTableScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  LogicalTableScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
 
 == Optimized Physical Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word], changelogMode=[I]): rowcount = 1.05E8, 
cumulative cost = {3.1E8 rows, 3.05E8 cpu, 4.0E9 io, 0.0 network, 0.0 memory}
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')], 
changelogMode=[I]): rowcount = 5000000.0, cumulative cost = {1.05E8 rows, 1.0E8 
cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
 
 == Optimized Execution Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Physical Execution Plan ==
+{
+  "nodes" : [ {
+    "id" : 37,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "parallelism" : 1
+  }, {
+    "id" : 38,
+    "type" : "Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])",
+    "pact" : "Operator",
+    "contents" : "Calc(select=[count, word], where=[LIKE(word, 
_UTF-16LE'F%')])",
+    "parallelism" : 1,
+    "predecessors" : [ {
+      "id" : 37,
+      "ship_strategy" : "FORWARD",
+      "side" : "second"
+    } ]
+  }, {
+    "id" : 39,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "parallelism" : 1
+  } ]
 ```
 
+{{< /tab >}}
+
+{{< /tabs >}}
+
 {{< top >}}
 
+## ExplainDetails
+```text
+Print the plan for the statement with specified ExplainDetails.
+
+ESTIMATED_COST: generates cost information on physical node estimated by 
optimizer, 
+e.g. TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 
0.0 network, 0.0 memory})
+
+CHANGELOG_MODE:generates changelog mode for every physical rel node. 
+e.g. GroupAggregate(..., changelogMode=[I,UA,D])
+
+JSON_EXECUTION_PLAN: generates the execution plan in json format of the 
program.
+```
+
+

Review comment:
       as above

##########
File path: docs/content/docs/dev/table/sql/explain.md
##########
@@ -139,52 +153,144 @@ table_result = t_env.execute_sql(
     "SELECT `count`, word FROM MyTable2")
 table_result.print()
 
+table_result2 = t_env.execute_sql(
+    "EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN "
+    "SELECT `count`, word FROM MyTable1 WHERE word LIKE 'F%' "
+    "UNION ALL "
+    "SELECT `count`, word FROM MyTable2")
+table_result2.print()
+
 ```
 {{< /tab >}}
 {{< tab "SQL CLI" >}}
+
 ```sql
-Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
-Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
 Flink SQL> EXPLAIN PLAN FOR SELECT `count`, word FROM MyTable1 WHERE word LIKE 
'F%' 
 > UNION ALL 
 > SELECT `count`, word FROM MyTable2;
-
+                                  
+Flink SQL> EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN SELECT 
`count`, word FROM MyTable1 
+> WHERE word LIKE 'F%' 
+> UNION ALL 
+> SELECT `count`, word FROM MyTable2;
 ```
 {{< /tab >}}
 {{< /tabs >}}
 
 The `EXPLAIN` result is:
+
+{{< tabs "explain result" >}}
+
+{{< tab "PLAN FOR" >}}
+
+```text
+== Abstract Syntax Tree ==
+LogicalUnion(all=[true])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
+
+== Optimized Physical Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Optimized Execution Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+```
+
+{{< /tab >}}
+
+{{< tab "EXPLAINDETAILS" >}}
+
 ```text
 == Abstract Syntax Tree ==
 LogicalUnion(all=[true])
-  LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
-    LogicalTableScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  LogicalTableScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
 
 == Optimized Physical Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word], changelogMode=[I]): rowcount = 1.05E8, 
cumulative cost = {3.1E8 rows, 3.05E8 cpu, 4.0E9 io, 0.0 network, 0.0 memory}
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')], 
changelogMode=[I]): rowcount = 5000000.0, cumulative cost = {1.05E8 rows, 1.0E8 
cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
 
 == Optimized Execution Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Physical Execution Plan ==
+{
+  "nodes" : [ {
+    "id" : 37,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "parallelism" : 1
+  }, {
+    "id" : 38,
+    "type" : "Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])",
+    "pact" : "Operator",
+    "contents" : "Calc(select=[count, word], where=[LIKE(word, 
_UTF-16LE'F%')])",
+    "parallelism" : 1,
+    "predecessors" : [ {
+      "id" : 37,
+      "ship_strategy" : "FORWARD",
+      "side" : "second"
+    } ]
+  }, {
+    "id" : 39,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "parallelism" : 1
+  } ]
 ```
 
+{{< /tab >}}
+
+{{< /tabs >}}
+
 {{< top >}}
 
+## ExplainDetails
+```text

Review comment:
       as above

##########
File path: docs/content.zh/docs/dev/table/sql/explain.md
##########
@@ -138,52 +153,144 @@ table_result = t_env.execute_sql(
     "SELECT `count`, word FROM MyTable2")
 table_result.print()
 
+table_result2 = t_env.execute_sql(
+    "EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN "
+    "SELECT `count`, word FROM MyTable1 WHERE word LIKE 'F%' "
+    "UNION ALL "
+    "SELECT `count`, word FROM MyTable2")
+table_result2.print()
+
 ```
 {{< /tab >}}
 {{< tab "SQL CLI" >}}
+
 ```sql
-Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable1 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
-Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256);
+Flink SQL> CREATE TABLE MyTable2 (`count` bigint, word VARCHAR(256)) WITH 
('connector' = 'datagen');
 [INFO] Table has been created.
 
 Flink SQL> EXPLAIN PLAN FOR SELECT `count`, word FROM MyTable1 WHERE word LIKE 
'F%' 
 > UNION ALL 
 > SELECT `count`, word FROM MyTable2;
-
+                                  
+Flink SQL> EXPLAIN ESTIMATED_COST, CHANGELOG_MODE, JSON_EXECUTION_PLAN SELECT 
`count`, word FROM MyTable1 
+> WHERE word LIKE 'F%' 
+> UNION ALL 
+> SELECT `count`, word FROM MyTable2;
 ```
 {{< /tab >}}
 {{< /tabs >}}
 
 The `EXPLAIN` result is:
+
+{{< tabs "explain result" >}}
+
+{{< tab "PLAN FOR" >}}
+
 ```text
 == Abstract Syntax Tree ==
 LogicalUnion(all=[true])
-  LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
-    LogicalTableScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  LogicalTableScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
 
 == Optimized Physical Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
 
 == Optimized Execution Plan ==
-Union(all=[true], union all=[count, word])
-  Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
-    TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
-  TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
 ```
 
+{{< /tab >}}
+
+{{< tab "EXPLAINDETAILS" >}}
+
+```text
+== Abstract Syntax Tree ==
+LogicalUnion(all=[true])
+:- LogicalProject(count=[$0], word=[$1])
+:  +- LogicalFilter(condition=[LIKE($1, _UTF-16LE'F%')])
+:     +- LogicalTableScan(table=[[default_catalog, default_database, 
MyTable1]])
++- LogicalProject(count=[$0], word=[$1])
+   +- LogicalTableScan(table=[[default_catalog, default_database, MyTable2]])
+
+== Optimized Physical Plan ==
+Union(all=[true], union=[count, word], changelogMode=[I]): rowcount = 1.05E8, 
cumulative cost = {3.1E8 rows, 3.05E8 cpu, 4.0E9 io, 0.0 network, 0.0 memory}
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')], 
changelogMode=[I]): rowcount = 5000000.0, cumulative cost = {1.05E8 rows, 1.0E8 
cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word], changelogMode=[I]): rowcount = 1.0E8, cumulative cost = 
{1.0E8 rows, 1.0E8 cpu, 2.0E9 io, 0.0 network, 0.0 memory}
+
+== Optimized Execution Plan ==
+Union(all=[true], union=[count, word])
+:- Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])
+:  +- TableSourceScan(table=[[default_catalog, default_database, MyTable1]], 
fields=[count, word])
++- TableSourceScan(table=[[default_catalog, default_database, MyTable2]], 
fields=[count, word])
+
+== Physical Execution Plan ==
+{
+  "nodes" : [ {
+    "id" : 37,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable1]], fields=[count, word])",
+    "parallelism" : 1
+  }, {
+    "id" : 38,
+    "type" : "Calc(select=[count, word], where=[LIKE(word, _UTF-16LE'F%')])",
+    "pact" : "Operator",
+    "contents" : "Calc(select=[count, word], where=[LIKE(word, 
_UTF-16LE'F%')])",
+    "parallelism" : 1,
+    "predecessors" : [ {
+      "id" : 37,
+      "ship_strategy" : "FORWARD",
+      "side" : "second"
+    } ]
+  }, {
+    "id" : 39,
+    "type" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "pact" : "Data Source",
+    "contents" : "Source: TableSourceScan(table=[[default_catalog, 
default_database, MyTable2]], fields=[count, word])",
+    "parallelism" : 1
+  } ]
+```
+
+{{< /tab >}}
+
+{{< /tabs >}}
+
 {{< top >}}
 
+## ExplainDetails
+```sql
+Print the plan for the statement with specified ExplainDetails.
+
+ESTIMATED_COST: generates cost information on physical node estimated by 
optimizer, 
+e.g. TableSourceScan(..., cumulative cost ={1.0E8 rows, 1.0E8 cpu, 2.4E9 io, 
0.0 network, 0.0 memory})
+
+CHANGELOG_MODE:generates changelog mode for every physical rel node. 
+e.g. GroupAggregate(..., changelogMode=[I,UA,D])
+
+JSON_EXECUTION_PLAN: generates the execution plan in json format of the 
program.
+```
+
+
+
 ## Syntax
 
 ```sql
-EXPLAIN PLAN FOR <query_statement_or_insert_statement>
+EXPLAIN [([ExplainDetail[, ExplainDetail]*]) | PLAN FOR] 
<query_statement_or_insert_statement>
 ```
 
+

Review comment:
       useless




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