Skip to content

Commit 710c57f

Browse files
DongLiang-0yuanyuan8983
authored andcommitted
improve query(), number(),tasks(),jobs(),partitions() function article format (apache#1844)
## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [ ] Checked by AI - [ ] Test Cases Built
1 parent 54c76f8 commit 710c57f

File tree

36 files changed

+1652
-2252
lines changed

36 files changed

+1652
-2252
lines changed

docs/sql-manual/sql-functions/table-functions/numbers.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/sql-manual/sql-functions/table-valued-functions/jobs.md

Lines changed: 62 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -24,127 +24,87 @@ specific language governing permissions and limitations
2424
under the License.
2525
-->
2626

27-
## `jobs`
28-
29-
### Name
30-
31-
jobs
32-
33-
### description
27+
## Description
3428

3529
Table function, generating a temporary task table, which can view job information in a certain task type.
3630

37-
This function is used in the from clause.
31+
## Syntax
3832

39-
This function is supported since 2.1.0.
33+
```sql
34+
JOBS(
35+
"type"="<type>"
36+
)
37+
```
4038

41-
#### syntax
39+
## Required Parameters
40+
| Field | Description |
41+
|---------------|-----------------------------------------------------------------------------------------------|
42+
| **`<type>`** | The type of the job: <br/> `insert`: Insert into type job. <br/> `mv`: Materialized view job. |
4243

43-
`jobs("type"="")`
4444

45-
**parameter description**
4645

47-
| parameter | description | type | required |
48-
|:----------|:------------|:-------|:---------|
49-
| type | job type | string | yes |
46+
## Return Value
5047

51-
the **type** supported types
52-
- insert: insert into type job
53-
- mv: materialized view job
48+
- **`jobs("type"="insert")`** Job return value of type insert
5449

55-
##### insert job
56-
jobs("type"="insert")Table structure:
57-
```
58-
mysql> desc function jobs("type"="insert");
59-
+-------------------+------+------+-------+---------+-------+
60-
| Field | Type | Null | Key | Default | Extra |
61-
+-------------------+------+------+-------+---------+-------+
62-
| Id | TEXT | No | false | NULL | NONE |
63-
| Name | TEXT | No | false | NULL | NONE |
64-
| Definer | TEXT | No | false | NULL | NONE |
65-
| ExecuteType | TEXT | No | false | NULL | NONE |
66-
| RecurringStrategy | TEXT | No | false | NULL | NONE |
67-
| Status | TEXT | No | false | NULL | NONE |
68-
| ExecuteSql | TEXT | No | false | NULL | NONE |
69-
| CreateTime | TEXT | No | false | NULL | NONE |
70-
| SucceedTaskCount | TEXT | No | false | NULL | NONE |
71-
| FailedTaskCount | TEXT | No | false | NULL | NONE |
72-
| CanceledTaskCount | TEXT | No | false | NULL | NONE |
73-
| Comment | TEXT | No | false | NULL | NONE |
74-
+-------------------+------+------+-------+---------+-------+
75-
12 rows in set (0.01 sec)
76-
```
77-
* Id: job ID.
78-
* Name: job name.
79-
* Definer: job definer.
80-
* ExecuteType: Execution type
81-
* RecurringStrategy: recurring strategy
82-
* Status: Job status
83-
* ExecuteSql: Execution SQL
84-
* CreateTime: Job creation time
85-
* SucceedTaskCount: Number of successful tasks
86-
* FailedTaskCount: Number of failed tasks
87-
* CanceledTaskCount: Number of canceled tasks
88-
* Comment: job comment
89-
90-
##### matterialized view job
91-
92-
jobs("type"="mv")Table structure:
93-
```sql
94-
mysql> desc function jobs("type"="mv");
95-
+-------------------+------+------+-------+---------+-------+
96-
| Field | Type | Null | Key | Default | Extra |
97-
+-------------------+------+------+-------+---------+-------+
98-
| Id | TEXT | No | false | NULL | NONE |
99-
| Name | TEXT | No | false | NULL | NONE |
100-
| MvId | TEXT | No | false | NULL | NONE |
101-
| MvName | TEXT | No | false | NULL | NONE |
102-
| MvDatabaseId | TEXT | No | false | NULL | NONE |
103-
| MvDatabaseName | TEXT | No | false | NULL | NONE |
104-
| ExecuteType | TEXT | No | false | NULL | NONE |
105-
| RecurringStrategy | TEXT | No | false | NULL | NONE |
106-
| Status | TEXT | No | false | NULL | NONE |
107-
| CreateTime | TEXT | No | false | NULL | NONE |
108-
+-------------------+------+------+-------+---------+-------+
109-
10 rows in set (0.00 sec)
110-
```
50+
| Field | Description |
51+
|--------------------|----------------------------|
52+
| Id | Job ID |
53+
| Name | Job name |
54+
| Definer | Job definer |
55+
| ExecuteType | Execution type |
56+
| RecurringStrategy | Recurring strategy |
57+
| Status | Job status |
58+
| ExecuteSql | Execution SQL |
59+
| CreateTime | Job creation time |
60+
| SucceedTaskCount | Number of successful tasks |
61+
| FailedTaskCount | Number of failed tasks |
62+
| CanceledTaskCount | Number of canceled tasks |
63+
| Comment | Job comment |
11164

112-
* Id: job ID.
113-
* Name: job name.
114-
* MvId: Materialized View ID
115-
* MvName: Materialized View Name
116-
* MvDatabaseId: DB ID of the materialized view
117-
* MvDatabaseName: Name of the database to which the materialized view belongs
118-
* ExecuteType: Execution type
119-
* RecurringStrategy: Loop strategy
120-
* Status: Job status
121-
* CreateTime: Task creation time
12265

123-
### example
66+
- **`jobs("type"="mv")`** MV type job return value
12467

125-
1. View jobs in all materialized views
68+
| Field | Description |
69+
|----------------------|-------------------------------------------------------------|
70+
| Id | job ID |
71+
| Name | job name |
72+
| MvId | Materialized View ID |
73+
| MvName | Materialized View Name |
74+
| MvDatabaseId | DB ID of the materialized view |
75+
| MvDatabaseName | Name of the database to which the materialized view belongs |
76+
| ExecuteType | Execution type |
77+
| RecurringStrategy | Loop strategy |
78+
| Status | Job status |
79+
| CreateTime | Task creation time |
12680

127-
```sql
128-
mysql> select * from jobs("type"="mv");
129-
```
13081

131-
2. View job with name `inner_mtmv_75043`
132-
133-
```sql
134-
mysql> select * from jobs("type"="mv") where Name="inner_mtmv_75043";
135-
```
82+
## Examples
13683

137-
3. View all insert jobs
84+
View jobs in all materialized views
13885

13986
```sql
140-
mysql> select * from jobs("type"="insert");
87+
select * from jobs("type"="mv");
88+
```
89+
```text
90+
+-------+------------------+-------+--------------------------+--------------+--------------------------------------------------------+-------------+-------------------+---------+---------------------+
91+
| Id | Name | MvId | MvName | MvDatabaseId | MvDatabaseName | ExecuteType | RecurringStrategy | Status | CreateTime |
92+
+-------+------------------+-------+--------------------------+--------------+--------------------------------------------------------+-------------+-------------------+---------+---------------------+
93+
| 23369 | inner_mtmv_23363 | 23363 | range_date_up_union_mv1 | 21805 | regression_test_nereids_rules_p0_mv_create_part_and_up | MANUAL | MANUAL TRIGGER | RUNNING | 2025-01-08 18:19:10 |
94+
| 23377 | inner_mtmv_23371 | 23371 | range_date_up_union_mv2 | 21805 | regression_test_nereids_rules_p0_mv_create_part_and_up | MANUAL | MANUAL TRIGGER | RUNNING | 2025-01-08 18:19:10 |
95+
| 21794 | inner_mtmv_21788 | 21788 | test_tablet_type_mtmv_mv | 16016 | zd | MANUAL | MANUAL TRIGGER | RUNNING | 2025-01-08 12:26:06 |
96+
| 19508 | inner_mtmv_19494 | 19494 | mv1 | 16016 | zd | MANUAL | MANUAL TRIGGER | RUNNING | 2025-01-07 22:13:31 |
97+
+-------+------------------+-------+--------------------------+--------------+--------------------------------------------------------+-------------+-------------------+---------+---------------------+
14198
```
142-
4. View job with name `one_insert_job`
14399

100+
View all insert jobs
144101
```sql
145-
mysql> select * from jobs("type"="insert") where Name='one_insert_job';
102+
select * from jobs("type"="insert");
146103
```
147-
148-
### keywords
149-
150-
jobs, job, insert, mv, materialized view, schedule
104+
```text
105+
+----------------+----------------+---------+-------------+--------------------------------------------+---------+--------------------------------------------------------------+---------------------+------------------+-----------------+-------------------+---------+
106+
| Id | Name | Definer | ExecuteType | RecurringStrategy | Status | ExecuteSql | CreateTime | SucceedTaskCount | FailedTaskCount | CanceledTaskCount | Comment |
107+
+----------------+----------------+---------+-------------+--------------------------------------------+---------+--------------------------------------------------------------+---------------------+------------------+-----------------+-------------------+---------+
108+
| 78533940810334 | insert_tab_job | root | RECURRING | EVERY 10 MINUTE STARTS 2025-01-17 14:42:53 | RUNNING | INSERT INTO test.insert_tab SELECT * FROM test.example_table | 2025-01-17 14:32:53 | 0 | 0 | 0 | |
109+
+----------------+----------------+---------+-------------+--------------------------------------------+---------+--------------------------------------------------------------+---------------------+------------------+-----------------+-------------------+---------+
110+
```

docs/sql-manual/sql-functions/table-valued-functions/numbers.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,44 @@ specific language governing permissions and limitations
2424
under the License.
2525
-->
2626

27-
## `numbers`
2827

29-
### description
28+
## Description
3029

3130
Table function that generates a temporary table containing only one column with the column name `number` and all element values are `const_value` if `const_value` is specified, otherwise they are [0,`number`) incremented.
3231

33-
#### syntax
32+
## Syntax
3433
```sql
35-
numbers(
36-
"number" = "n"
37-
<, "const_value" = "x">
34+
NUMBERS(
35+
"number" = "<number>"
36+
[, "<const_value>" = "<const_value>" ]
3837
);
3938
```
4039

41-
parameter:
42-
- `number`: Line number.
43-
- `const_value`: the constant value.
40+
## Required Parameters
4441

45-
### example
42+
| Field | Description |
43+
|---------------|---------------------------|
44+
| **number** | The number of rows |
45+
46+
## Optional Parameters
47+
48+
| Field | Description |
49+
|-------------------|------------------------------------------|
50+
| **const_value** | Specifies the constant value generated |
51+
52+
53+
54+
## Return Value
55+
| Field | Type | Description |
56+
|----------------|---------|---------------------------------|
57+
| **number** | BIGINT | The value returned for each row |
58+
59+
60+
## Examples
61+
```sql
62+
select * from numbers("number" = "5");
4663
```
47-
mysql> select * from numbers("number" = "5");
64+
```text
4865
+--------+
4966
| number |
5067
+--------+
@@ -54,9 +71,12 @@ mysql> select * from numbers("number" = "5");
5471
| 3 |
5572
| 4 |
5673
+--------+
57-
5 rows in set (0.11 sec)
74+
```
5875

59-
mysql> select * from numbers("number" = "5", "const_value" = "-123");
76+
```sql
77+
select * from numbers("number" = "5", "const_value" = "-123");
78+
```
79+
```text
6080
+--------+
6181
| number |
6282
+--------+
@@ -66,9 +86,4 @@ mysql> select * from numbers("number" = "5", "const_value" = "-123");
6686
| -123 |
6787
| -123 |
6888
+--------+
69-
5 rows in set (0.12 sec)
70-
```
71-
72-
### keywords
73-
74-
numbers, const_value
89+
```

0 commit comments

Comments
 (0)