Skip to content

Commit bebcc47

Browse files
committed
query()
1 parent 87b3a9a commit bebcc47

File tree

6 files changed

+172
-178
lines changed
  • docs/sql-manual/sql-functions/table-valued-functions
  • i18n/zh-CN/docusaurus-plugin-content-docs
    • current/sql-manual/sql-functions/table-valued-functions
    • version-2.1/sql-manual/sql-functions/table-valued-functions
    • version-3.0/sql-manual/sql-functions/table-valued-functions
  • versioned_docs
    • version-2.1/sql-manual/sql-functions/table-valued-functions
    • version-3.0/sql-manual/sql-functions/table-valued-functions

6 files changed

+172
-178
lines changed

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

+29-30
Original file line numberDiff line numberDiff line change
@@ -24,69 +24,66 @@ specific language governing permissions and limitations
2424
under the License.
2525
-->
2626

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

3529
Query table function (table-valued-function, tvf) can be used to transparently transmit query statements directly to a catalog for data query
3630

37-
:::info note
3831
Supported by Doris version 2.1.3, currently only transparent query jdbc catalog is supported.
3932
You need to create the corresponding catalog in Doris first.
40-
:::
4133

42-
#### syntax
34+
35+
## Syntax
4336

4437
```sql
45-
query(
46-
"catalog" = "catalog_name",
47-
"query" = "select * from db_name.table_name where condition"
38+
QUERY(
39+
"catalog" = "<catalog>",
40+
"query" = "<query_sql>"
4841
);
4942
```
5043

51-
**Parameter Description**
52-
44+
## Required Parameters
5345
Each parameter in the query table function tvf is a `"key"="value"` pair.
54-
Related parameters:
55-
- `catalog`: (required) catalog name, which needs to be filled in according to the name of the catalog.
56-
- `query`: (required) The query statement to be executed.
5746

58-
### Example
47+
| Field | Description |
48+
|------------|--------------------------------------------|
49+
| `catalog` | Catalog name, which needs to be filled in according to the name of the catalog. |
50+
| `query` | The query statement to be executed. |
5951

60-
Use the query function to query tables in the jdbc data source
6152

62-
```sql
63-
select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition");
64-
```
53+
## Examples
6554

6655
Can be used with `desc function`
6756

6857
```sql
69-
desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition");
58+
desc function query("catalog" = "jdbc", "query" = "select * from test.student");
59+
```
60+
```text
61+
+-------+------+------+-------+---------+-------+
62+
| Field | Type | Null | Key | Default | Extra |
63+
+-------+------+------+-------+---------+-------+
64+
| id | int | Yes | true | NULL | |
65+
| name | text | Yes | false | NULL | NONE |
66+
+-------+------+------+-------+---------+-------+
7067
```
71-
72-
### Keywords
73-
74-
query, table-valued-function, tvf
75-
76-
### Best Prac
7768

7869
Transparent query for tables in jdbc catalog data source
7970

8071
```sql
8172
select * from query("catalog" = "jdbc", "query" = "select * from test.student");
73+
```
74+
```text
8275
+------+---------+
8376
| id | name |
8477
+------+---------+
8578
| 1 | alice |
8679
| 2 | bob |
8780
| 3 | jack |
8881
+------+---------+
82+
```
83+
```sql
8984
select * from query("catalog" = "jdbc", "query" = "select * from test.score");
85+
```
86+
```text
9087
+------+---------+
9188
| id | score |
9289
+------+---------+
@@ -100,6 +97,8 @@ Transparent join query for tables in jdbc catalog data source
10097

10198
```sql
10299
select * from query("catalog" = "jdbc", "query" = "select a.id, a.name, b.score from test.student a join test.score b on a.id = b.id");
100+
```
101+
```
103102
+------+---------+---------+
104103
| id | name | score |
105104
+------+---------+---------+

i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-valued-functions/query.md

+27-28
Original file line numberDiff line numberDiff line change
@@ -24,69 +24,66 @@ specific language governing permissions and limitations
2424
under the License.
2525
-->
2626

27-
## query
28-
29-
### Name
30-
31-
query
3227

3328
## 描述
3429

3530
query 表函数(table-valued-function,tvf),可用于将查询语句直接透传到某个 catalog 进行数据查询
3631

37-
:::info note
3832
Doris 2.1.3 版本开始支持,当前仅支持透传查询 jdbc catalog。
3933
需要先在 Doris 中创建对应的 catalog。
40-
:::
4134

4235
## 语法
4336

4437
```sql
45-
query(
46-
"catalog" = "catalog_name",
47-
"query" = "select * from db_name.table_name where condition"
38+
QUERY(
39+
"catalog" = "<catalog>",
40+
"query" = "<query_sql>"
4841
);
4942
```
5043

51-
**参数说明**
44+
## 必填参数
45+
query表函数 tvf中的每一个参数都是一个 `"key"="value"`
5246

53-
query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对。
54-
相关参数:
55-
- `catalog`: (必填) catalog名称,需要按照catalog的名称填写
56-
- `query`: (必填) 需要执行的查询语句
47+
| 字段 | 描述 |
48+
|--------------|----------------------------|
49+
| `catalog` | catalog名称,需要按照catalog的名称填写 |
50+
| `query` | 需要执行的查询语句 |
5751

58-
## 举例
5952

60-
使用 query 函数查询 jdbc 数据源中的表
61-
62-
```sql
63-
select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition");
64-
```
53+
## 举例
6554

6655
可以配合`desc function`使用
6756

6857
```sql
69-
desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition");
58+
desc function query("catalog" = "jdbc", "query" = "select * from test.student");
59+
```
60+
```text
61+
+-------+------+------+-------+---------+-------+
62+
| Field | Type | Null | Key | Default | Extra |
63+
+-------+------+------+-------+---------+-------+
64+
| id | int | Yes | true | NULL | |
65+
| name | text | Yes | false | NULL | NONE |
66+
+-------+------+------+-------+---------+-------+
7067
```
71-
72-
### Keywords
73-
74-
query, table-valued-function, tvf
75-
76-
### Best Prac
7768

7869
透传查询 jdbc catalog 数据源中的表
7970

8071
```sql
8172
select * from query("catalog" = "jdbc", "query" = "select * from test.student");
73+
```
74+
```text
8275
+------+---------+
8376
| id | name |
8477
+------+---------+
8578
| 1 | alice |
8679
| 2 | bob |
8780
| 3 | jack |
8881
+------+---------+
82+
```
83+
```sql
8984
select * from query("catalog" = "jdbc", "query" = "select * from test.score");
85+
```
86+
```text
9087
+------+---------+
9188
| id | score |
9289
+------+---------+
@@ -100,6 +97,8 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.score");
10097

10198
```sql
10299
select * from query("catalog" = "jdbc", "query" = "select a.id, a.name, b.score from test.student a join test.score b on a.id = b.id");
100+
```
101+
```
103102
+------+---------+---------+
104103
| id | name | score |
105104
+------+---------+---------+

i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md

+29-30
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
{
3-
"title": "QUERY",
4-
"language": "zh-CN"
3+
"title": "QUERY",
4+
"language": "zh-CN"
55
}
66
---
77

@@ -24,69 +24,66 @@ specific language governing permissions and limitations
2424
under the License.
2525
-->
2626

27-
## query
28-
29-
### Name
30-
31-
query
3227

3328
## 描述
3429

3530
query 表函数(table-valued-function,tvf),可用于将查询语句直接透传到某个 catalog 进行数据查询
3631

37-
:::info note
3832
Doris 2.1.3 版本开始支持,当前仅支持透传查询 jdbc catalog。
3933
需要先在 Doris 中创建对应的 catalog。
40-
:::
4134

4235
## 语法
4336

4437
```sql
45-
query(
46-
"catalog" = "catalog_name",
47-
"query" = "select * from db_name.table_name where condition"
38+
QUERY(
39+
"catalog" = "<catalog>",
40+
"query" = "<query_sql>"
4841
);
4942
```
5043

51-
**参数说明**
44+
## 必填参数
45+
query表函数 tvf中的每一个参数都是一个 `"key"="value"`
5246

53-
query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对。
54-
相关参数:
55-
- `catalog`: (必填) catalog名称,需要按照catalog的名称填写
56-
- `query`: (必填) 需要执行的查询语句
47+
| 字段 | 描述 |
48+
|--------------|----------------------------|
49+
| `catalog` | catalog名称,需要按照catalog的名称填写 |
50+
| `query` | 需要执行的查询语句 |
5751

58-
## 举例
5952

60-
使用 query 函数查询 jdbc 数据源中的表
61-
62-
```sql
63-
select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition");
64-
```
53+
## 举例
6554

6655
可以配合`desc function`使用
6756

6857
```sql
69-
desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition");
58+
desc function query("catalog" = "jdbc", "query" = "select * from test.student");
59+
```
60+
```text
61+
+-------+------+------+-------+---------+-------+
62+
| Field | Type | Null | Key | Default | Extra |
63+
+-------+------+------+-------+---------+-------+
64+
| id | int | Yes | true | NULL | |
65+
| name | text | Yes | false | NULL | NONE |
66+
+-------+------+------+-------+---------+-------+
7067
```
71-
72-
### Keywords
73-
74-
query, table-valued-function, tvf
75-
76-
### Best Prac
7768

7869
透传查询 jdbc catalog 数据源中的表
7970

8071
```sql
8172
select * from query("catalog" = "jdbc", "query" = "select * from test.student");
73+
```
74+
```text
8275
+------+---------+
8376
| id | name |
8477
+------+---------+
8578
| 1 | alice |
8679
| 2 | bob |
8780
| 3 | jack |
8881
+------+---------+
82+
```
83+
```sql
8984
select * from query("catalog" = "jdbc", "query" = "select * from test.score");
85+
```
86+
```text
9087
+------+---------+
9188
| id | score |
9289
+------+---------+
@@ -100,6 +97,8 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.score");
10097

10198
```sql
10299
select * from query("catalog" = "jdbc", "query" = "select a.id, a.name, b.score from test.student a join test.score b on a.id = b.id");
100+
```
101+
```
103102
+------+---------+---------+
104103
| id | name | score |
105104
+------+---------+---------+

0 commit comments

Comments
 (0)