Skip to content

Commit cae9db9

Browse files
xuyangzhonglsyldliu
authored andcommitted
[FLINK-35271][docs] Add doc for DESCRIBE JOB <JOB_ID> statement
This closes apache#24984 (cherry picked from commit 7fc3aac)
1 parent 83e6521 commit cae9db9

File tree

4 files changed

+94
-12
lines changed

4 files changed

+94
-12
lines changed

docs/content.zh/docs/dev/table/sql/describe.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,25 @@ under the License.
2828

2929
# DESCRIBE 语句
3030

31-
DESCRIBE 语句用于描述表或视图的 schema 或 catalog 的元数据
31+
DESCRIBE 语句用于描述表或视图的 schema,或catalog 的元数据,或 Flink 集群上的指定作业
3232

3333
<a name="run-a-describe-statement"></a>
3434

3535
## 执行 DESCRIBE 语句
3636

3737
{{< tabs "describe" >}}
3838
{{< tab "Java" >}}
39-
可以使用 `TableEnvironment``executeSql()` 方法执行 DESCRIBE 语句。如果 DESCRIBE 操作执行成功,`executeSql()` 方法会返回给定表的 schema,否则会抛出异常。
39+
可以使用 `TableEnvironment``executeSql()` 方法执行 DESCRIBE 语句。如果 DESCRIBE 操作执行成功,`executeSql()` 方法会返回所有对象,否则会抛出异常。
4040

4141
以下示例展示了如何在 `TableEnvironment` 中执行一条 DESCRIBE 语句。
4242
{{< /tab >}}
4343
{{< tab "Scala" >}}
44-
可以使用 `TableEnvironment``executeSql()` 方法执行 DESCRIBE 语句。如果 DESCRIBE 操作执行成功,`executeSql()` 方法会返回给定表的 schema,否则会抛出异常。
44+
可以使用 `TableEnvironment``executeSql()` 方法执行 DESCRIBE 语句。如果 DESCRIBE 操作执行成功,`executeSql()` 方法会返回所有对象,否则会抛出异常。
4545

4646
以下示例展示了如何在 `TableEnvironment` 中执行一条 DESCRIBE 语句。
4747
{{< /tab >}}
4848
{{< tab "Python" >}}
49-
可以使用 `TableEnvironment``execute_sql()` 方法执行 DESCRIBE 语句。如果 DESCRIBE 操作执行成功,`execute_sql()` 方法会返回给定表的 schema,否则会抛出异常。
49+
可以使用 `TableEnvironment``execute_sql()` 方法执行 DESCRIBE 语句。如果 DESCRIBE 操作执行成功,`execute_sql()` 方法会返回所有对象,否则会抛出异常。
5050

5151
以下示例展示了如何在 `TableEnvironment` 中执行一条 DESCRIBE 语句。
5252
{{< /tab >}}
@@ -181,6 +181,10 @@ Flink SQL> CREATE CATALOG cat2 WITH ('type'='generic_in_memory', 'default-databa
181181
Flink SQL> DESCRIBE CATALOG cat2;
182182

183183
Flink SQL> DESC CATALOG EXTENDED cat2;
184+
185+
Flink SQL> DESCRIBE JOB '228d70913eab60dda85c5e7f78b5782c';
186+
187+
Flink SQL> DESC JOB '228d70913eab60dda85c5e7f78b5782c';
184188
```
185189
{{< /tab >}}
186190
{{< /tabs >}}
@@ -329,6 +333,14 @@ Flink SQL> DESC CATALOG EXTENDED cat2;
329333
| option:default-database | db |
330334
+-------------------------+-------------------+
331335
4 rows in set
336+
337+
# DESCRIBE JOB '228d70913eab60dda85c5e7f78b5782c'
338+
+----------------------------------+----------+---------+-------------------------+
339+
| job id | job name | status | start time |
340+
+----------------------------------+----------+---------+-------------------------+
341+
| 228d70913eab60dda85c5e7f78b5782c | myjob | RUNNING | 2023-02-11T05:03:51.523 |
342+
+----------------------------------+----------+---------+-------------------------+
343+
1 row in set
332344
```
333345
{{< /tab >}}
334346
{{< /tabs >}}
@@ -339,11 +351,22 @@ Flink SQL> DESC CATALOG EXTENDED cat2;
339351

340352
## 语法
341353

342-
- DESCRIBE TABLE
354+
### DESCRIBE TABLE
355+
343356
```sql
344357
{ DESCRIBE | DESC } [catalog_name.][db_name.]table_name
345358
```
346-
- DESCRIBE CATALOG
359+
360+
### DESCRIBE CATALOG
361+
347362
```sql
348363
{ DESCRIBE | DESC } CATALOG [EXTENDED] catalog_name
349364
```
365+
366+
### DESCRIBE JOB
367+
368+
```sql
369+
{ DESCRIBE | DESC } JOB '<job_id>'
370+
```
371+
372+
<span class="label label-danger">Attention</span> DESCRIBE JOB 语句仅适用于 [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) 或者 [SQL Gateway]({{< ref "docs/dev/table/sql-gateway/overview" >}}).

docs/content.zh/docs/dev/table/sql/job.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Job 语句用于管理作业的生命周期。
3030

3131
目前 Flink SQL 支持以下 JOB 语句:
3232
- SHOW JOBS
33+
- DESCRIBE JOB
3334
- STOP JOB
3435

3536
## 执行 JOB 语句
@@ -52,6 +53,13 @@ Flink SQL> SHOW JOBS;
5253
| 228d70913eab60dda85c5e7f78b5782c | myjob | RUNNING | 2023-02-11T05:03:51.523 |
5354
+----------------------------------+----------+---------+-------------------------+
5455

56+
Flink SQL> DESCRIBE JOB '228d70913eab60dda85c5e7f78b5782c';
57+
+----------------------------------+----------+---------+-------------------------+
58+
| job id | job name | status | start time |
59+
+----------------------------------+----------+---------+-------------------------+
60+
| 228d70913eab60dda85c5e7f78b5782c | myjob | RUNNING | 2023-02-11T05:03:51.523 |
61+
+----------------------------------+----------+---------+-------------------------+
62+
5563
Flink SQL> SET 'execution.checkpointing.savepoint-dir'='file:/tmp/';
5664
[INFO] Execute statement succeeded.
5765

@@ -75,6 +83,16 @@ SHOW JOBS
7583

7684
<span class="label label-danger">Attention</span> SHOW JOBS 语句仅适用于 [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) 或者 [SQL Gateway]({{< ref "docs/dev/table/sql-gateway/overview" >}}).
7785

86+
## DESCRIBE JOB
87+
88+
```sql
89+
{ DESCRIBE | DESC } JOB '<job_id>'
90+
```
91+
92+
展示 Flink 集群上的指定作业。
93+
94+
<span class="label label-danger">Attention</span> DESCRIBE JOB 语句仅适用于 [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) 或者 [SQL Gateway]({{< ref "docs/dev/table/sql-gateway/overview" >}}).
95+
7896
## STOP JOB
7997

8098
```sql

docs/content/docs/dev/table/sql/describe.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ under the License.
2626

2727
# DESCRIBE Statements
2828

29-
DESCRIBE statements are used to describe the schema of a table or a view, or the metadata of a catalog.
29+
DESCRIBE statements are used to describe the schema of a table or a view, or the metadata of a catalog, or the specified job in the Flink cluster.
3030

3131

3232
## Run a DESCRIBE statement
3333

3434
{{< tabs "describe" >}}
3535
{{< tab "Java" >}}
36-
DESCRIBE statements can be executed with the `executeSql()` method of the `TableEnvironment`. The `executeSql()` method returns the schema of given table for a successful DESCRIBE operation, otherwise will throw an exception.
36+
DESCRIBE statements can be executed with the `executeSql()` method of the `TableEnvironment`. The `executeSql()` method returns objects for a successful DESCRIBE operation, otherwise will throw an exception.
3737

3838
The following examples show how to run a DESCRIBE statement in `TableEnvironment`.
3939
{{< /tab >}}
4040
{{< tab "Scala" >}}
41-
DESCRIBE statements can be executed with the `executeSql()` method of the `TableEnvironment`. The `executeSql()` method returns the schema of given table for a successful DESCRIBE operation, otherwise will throw an exception.
41+
DESCRIBE statements can be executed with the `executeSql()` method of the `TableEnvironment`. The `executeSql()` method returns objects for a successful DESCRIBE operation, otherwise will throw an exception.
4242

4343
The following examples show how to run a DESCRIBE statement in `TableEnvironment`.
4444
{{< /tab >}}
4545
{{< tab "Python" >}}
4646

47-
DESCRIBE statements can be executed with the `execute_sql()` method of the `TableEnvironment`. The `execute_sql()` method returns the schema of given table for a successful DESCRIBE operation, otherwise will throw an exception.
47+
DESCRIBE statements can be executed with the `execute_sql()` method of the `TableEnvironment`. The `execute_sql()` method returns objects for a successful DESCRIBE operation, otherwise will throw an exception.
4848

4949
The following examples show how to run a DESCRIBE statement in `TableEnvironment`.
5050

@@ -180,6 +180,10 @@ Flink SQL> CREATE CATALOG cat2 WITH ('type'='generic_in_memory', 'default-databa
180180
Flink SQL> DESCRIBE CATALOG cat2;
181181

182182
Flink SQL> DESC CATALOG EXTENDED cat2;
183+
184+
Flink SQL> DESCRIBE JOB '228d70913eab60dda85c5e7f78b5782c';
185+
186+
Flink SQL> DESC JOB '228d70913eab60dda85c5e7f78b5782c';
183187
```
184188
{{< /tab >}}
185189
{{< /tabs >}}
@@ -329,6 +333,14 @@ The result of the above example is:
329333
+-------------------------+-------------------+
330334
4 rows in set
331335
336+
# DESCRIBE JOB '228d70913eab60dda85c5e7f78b5782c'
337+
+----------------------------------+----------+---------+-------------------------+
338+
| job id | job name | status | start time |
339+
+----------------------------------+----------+---------+-------------------------+
340+
| 228d70913eab60dda85c5e7f78b5782c | myjob | RUNNING | 2023-02-11T05:03:51.523 |
341+
+----------------------------------+----------+---------+-------------------------+
342+
1 row in set
343+
332344
```
333345
{{< /tab >}}
334346
{{< /tabs >}}
@@ -338,11 +350,21 @@ The result of the above example is:
338350

339351
## Syntax
340352

341-
- DESCRIBE TABLE
353+
### DESCRIBE TABLE
354+
342355
```sql
343356
{ DESCRIBE | DESC } [catalog_name.][db_name.]table_name
344357
```
345-
- DESCRIBE CATALOG
358+
359+
### DESCRIBE CATALOG
360+
346361
```sql
347362
{ DESCRIBE | DESC } CATALOG [EXTENDED] catalog_name
348363
```
364+
365+
### DESCRIBE JOB
366+
```sql
367+
{ DESCRIBE | DESC } JOB '<job_id>'
368+
```
369+
370+
<span class="label label-danger">Attention</span> DESCRIBE JOB statements only work in [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) or [SQL Gateway]({{< ref "docs/dev/table/sql-gateway/overview" >}}).

docs/content/docs/dev/table/sql/job.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Job statements are used for management of Flink jobs.
3030

3131
Flink SQL supports the following JOB statements for now:
3232
- SHOW JOBS
33+
- DESCRIBE JOB
3334
- STOP JOB
3435

3536
## Run a JOB statement
@@ -52,6 +53,13 @@ Flink SQL> SHOW JOBS;
5253
| 228d70913eab60dda85c5e7f78b5782c | myjob | RUNNING | 2023-02-11T05:03:51.523 |
5354
+----------------------------------+----------+---------+-------------------------+
5455

56+
Flink SQL> DESCRIBE JOB '228d70913eab60dda85c5e7f78b5782c';
57+
+----------------------------------+----------+---------+-------------------------+
58+
| job id | job name | status | start time |
59+
+----------------------------------+----------+---------+-------------------------+
60+
| 228d70913eab60dda85c5e7f78b5782c | myjob | RUNNING | 2023-02-11T05:03:51.523 |
61+
+----------------------------------+----------+---------+-------------------------+
62+
5563
Flink SQL> SET 'execution.checkpointing.savepoint-dir'='file:/tmp/';
5664
[INFO] Execute statement succeeded.
5765

@@ -75,6 +83,17 @@ Show the jobs in the Flink cluster.
7583

7684
<span class="label label-danger">Attention</span> SHOW JOBS statements only work in [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) or [SQL Gateway]({{< ref "docs/dev/table/sql-gateway/overview" >}}).
7785

86+
## DESCRIBE JOB
87+
88+
```sql
89+
{ DESCRIBE | DESC } JOB '<job_id>'
90+
```
91+
92+
Show the specified job in the Flink cluster.
93+
94+
<span class="label label-danger">Attention</span> DESCRIBE JOB statements only work in [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) or [SQL Gateway]({{< ref "docs/dev/table/sql-gateway/overview" >}}).
95+
96+
7897
## STOP JOB
7998

8099
```sql

0 commit comments

Comments
 (0)