diff --git a/docs/sql-manual/sql-functions/table-valued-functions/query.md b/docs/sql-manual/sql-functions/table-valued-functions/query.md index f3f0adfd5f2a3..f26d9c0d3de36 100644 --- a/docs/sql-manual/sql-functions/table-valued-functions/query.md +++ b/docs/sql-manual/sql-functions/table-valued-functions/query.md @@ -24,61 +24,54 @@ specific language governing permissions and limitations under the License. --> -## query - -### Name - -query - -### description +## Description Query table function (table-valued-function, tvf) can be used to transparently transmit query statements directly to a catalog for data query -:::info note Supported by Doris version 2.1.3, currently only transparent query jdbc catalog is supported. You need to create the corresponding catalog in Doris first. -::: -#### syntax + +## Syntax ```sql -query( - "catalog" = "catalog_name", - "query" = "select * from db_name.table_name where condition" +QUERY( + "catalog" = "", + "query" = "" ); ``` -**Parameter Description** - +## Required Parameters Each parameter in the query table function tvf is a `"key"="value"` pair. -Related parameters: -- `catalog`: (required) catalog name, which needs to be filled in according to the name of the catalog. -- `query`: (required) The query statement to be executed. -### Example +| Field | Description | +|------------|--------------------------------------------| +| `catalog` | Catalog name, which needs to be filled in according to the name of the catalog. | +| `query` | The query statement to be executed. | -Use the query function to query tables in the jdbc data source -```sql -select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); -``` +## Examples Can be used with `desc function` ```sql -desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); +desc function query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text ++-------+------+------+-------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+-------+---------+-------+ +| id | int | Yes | true | NULL | | +| name | text | Yes | false | NULL | NONE | ++-------+------+------+-------+---------+-------+ ``` - -### Keywords - - query, table-valued-function, tvf - -### Best Prac Transparent query for tables in jdbc catalog data source ```sql select * from query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text +------+---------+ | id | name | +------+---------+ @@ -86,7 +79,11 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.student"); | 2 | bob | | 3 | jack | +------+---------+ +``` +```sql select * from query("catalog" = "jdbc", "query" = "select * from test.score"); +``` +```text +------+---------+ | id | score | +------+---------+ @@ -100,6 +97,8 @@ Transparent join query for tables in jdbc catalog data source ```sql 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"); +``` +``` +------+---------+---------+ | id | name | score | +------+---------+---------+ diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-valued-functions/query.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-valued-functions/query.md index 17f183cdc9a50..2307fcdb0ac94 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-valued-functions/query.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-valued-functions/query.md @@ -24,61 +24,54 @@ specific language governing permissions and limitations under the License. --> -## query - -### Name - -query ## 描述 query 表函数(table-valued-function,tvf),可用于将查询语句直接透传到某个 catalog 进行数据查询 -:::info note Doris 2.1.3 版本开始支持,当前仅支持透传查询 jdbc catalog。 需要先在 Doris 中创建对应的 catalog。 -::: ## 语法 ```sql -query( - "catalog" = "catalog_name", - "query" = "select * from db_name.table_name where condition" +QUERY( + "catalog" = "", + "query" = "" ); ``` -**参数说明** +## 必填参数 +query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对 -query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对。 -相关参数: -- `catalog`: (必填) catalog名称,需要按照catalog的名称填写。 -- `query`: (必填) 需要执行的查询语句。 +| 字段 | 描述 | +|--------------|----------------------------| +| `catalog` | catalog名称,需要按照catalog的名称填写 | +| `query` | 需要执行的查询语句 | -## 举例 -使用 query 函数查询 jdbc 数据源中的表 - -```sql -select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); -``` +## 举例 可以配合`desc function`使用 ```sql -desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); +desc function query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text ++-------+------+------+-------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+-------+---------+-------+ +| id | int | Yes | true | NULL | | +| name | text | Yes | false | NULL | NONE | ++-------+------+------+-------+---------+-------+ ``` - -### Keywords - - query, table-valued-function, tvf - -### Best Prac 透传查询 jdbc catalog 数据源中的表 ```sql select * from query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text +------+---------+ | id | name | +------+---------+ @@ -86,7 +79,11 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.student"); | 2 | bob | | 3 | jack | +------+---------+ +``` +```sql select * from query("catalog" = "jdbc", "query" = "select * from test.score"); +``` +```text +------+---------+ | id | score | +------+---------+ @@ -100,6 +97,8 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.score"); ```sql 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"); +``` +``` +------+---------+---------+ | id | name | score | +------+---------+---------+ diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md index 17f183cdc9a50..f6314b344672e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md @@ -1,7 +1,7 @@ --- { -"title": "QUERY", -"language": "zh-CN" + "title": "QUERY", + "language": "zh-CN" } --- @@ -24,61 +24,54 @@ specific language governing permissions and limitations under the License. --> -## query - -### Name - -query ## 描述 query 表函数(table-valued-function,tvf),可用于将查询语句直接透传到某个 catalog 进行数据查询 -:::info note Doris 2.1.3 版本开始支持,当前仅支持透传查询 jdbc catalog。 需要先在 Doris 中创建对应的 catalog。 -::: ## 语法 ```sql -query( - "catalog" = "catalog_name", - "query" = "select * from db_name.table_name where condition" +QUERY( + "catalog" = "", + "query" = "" ); ``` -**参数说明** +## 必填参数 +query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对 -query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对。 -相关参数: -- `catalog`: (必填) catalog名称,需要按照catalog的名称填写。 -- `query`: (必填) 需要执行的查询语句。 +| 字段 | 描述 | +|--------------|----------------------------| +| `catalog` | catalog名称,需要按照catalog的名称填写 | +| `query` | 需要执行的查询语句 | -## 举例 -使用 query 函数查询 jdbc 数据源中的表 - -```sql -select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); -``` +## 举例 可以配合`desc function`使用 ```sql -desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); +desc function query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text ++-------+------+------+-------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+-------+---------+-------+ +| id | int | Yes | true | NULL | | +| name | text | Yes | false | NULL | NONE | ++-------+------+------+-------+---------+-------+ ``` - -### Keywords - - query, table-valued-function, tvf - -### Best Prac 透传查询 jdbc catalog 数据源中的表 ```sql select * from query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text +------+---------+ | id | name | +------+---------+ @@ -86,7 +79,11 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.student"); | 2 | bob | | 3 | jack | +------+---------+ +``` +```sql select * from query("catalog" = "jdbc", "query" = "select * from test.score"); +``` +```text +------+---------+ | id | score | +------+---------+ @@ -100,6 +97,8 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.score"); ```sql 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"); +``` +``` +------+---------+---------+ | id | name | score | +------+---------+---------+ diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md index 17f183cdc9a50..f6314b344672e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md @@ -1,7 +1,7 @@ --- { -"title": "QUERY", -"language": "zh-CN" + "title": "QUERY", + "language": "zh-CN" } --- @@ -24,61 +24,54 @@ specific language governing permissions and limitations under the License. --> -## query - -### Name - -query ## 描述 query 表函数(table-valued-function,tvf),可用于将查询语句直接透传到某个 catalog 进行数据查询 -:::info note Doris 2.1.3 版本开始支持,当前仅支持透传查询 jdbc catalog。 需要先在 Doris 中创建对应的 catalog。 -::: ## 语法 ```sql -query( - "catalog" = "catalog_name", - "query" = "select * from db_name.table_name where condition" +QUERY( + "catalog" = "", + "query" = "" ); ``` -**参数说明** +## 必填参数 +query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对 -query表函数 tvf中的每一个参数都是一个 `"key"="value"` 对。 -相关参数: -- `catalog`: (必填) catalog名称,需要按照catalog的名称填写。 -- `query`: (必填) 需要执行的查询语句。 +| 字段 | 描述 | +|--------------|----------------------------| +| `catalog` | catalog名称,需要按照catalog的名称填写 | +| `query` | 需要执行的查询语句 | -## 举例 -使用 query 函数查询 jdbc 数据源中的表 - -```sql -select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); -``` +## 举例 可以配合`desc function`使用 ```sql -desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); +desc function query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text ++-------+------+------+-------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+-------+---------+-------+ +| id | int | Yes | true | NULL | | +| name | text | Yes | false | NULL | NONE | ++-------+------+------+-------+---------+-------+ ``` - -### Keywords - - query, table-valued-function, tvf - -### Best Prac 透传查询 jdbc catalog 数据源中的表 ```sql select * from query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text +------+---------+ | id | name | +------+---------+ @@ -86,7 +79,11 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.student"); | 2 | bob | | 3 | jack | +------+---------+ +``` +```sql select * from query("catalog" = "jdbc", "query" = "select * from test.score"); +``` +```text +------+---------+ | id | score | +------+---------+ @@ -100,6 +97,8 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.score"); ```sql 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"); +``` +``` +------+---------+---------+ | id | name | score | +------+---------+---------+ diff --git a/versioned_docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md b/versioned_docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md index f3f0adfd5f2a3..f26d9c0d3de36 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md +++ b/versioned_docs/version-2.1/sql-manual/sql-functions/table-valued-functions/query.md @@ -24,61 +24,54 @@ specific language governing permissions and limitations under the License. --> -## query - -### Name - -query - -### description +## Description Query table function (table-valued-function, tvf) can be used to transparently transmit query statements directly to a catalog for data query -:::info note Supported by Doris version 2.1.3, currently only transparent query jdbc catalog is supported. You need to create the corresponding catalog in Doris first. -::: -#### syntax + +## Syntax ```sql -query( - "catalog" = "catalog_name", - "query" = "select * from db_name.table_name where condition" +QUERY( + "catalog" = "", + "query" = "" ); ``` -**Parameter Description** - +## Required Parameters Each parameter in the query table function tvf is a `"key"="value"` pair. -Related parameters: -- `catalog`: (required) catalog name, which needs to be filled in according to the name of the catalog. -- `query`: (required) The query statement to be executed. -### Example +| Field | Description | +|------------|--------------------------------------------| +| `catalog` | Catalog name, which needs to be filled in according to the name of the catalog. | +| `query` | The query statement to be executed. | -Use the query function to query tables in the jdbc data source -```sql -select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); -``` +## Examples Can be used with `desc function` ```sql -desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); +desc function query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text ++-------+------+------+-------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+-------+---------+-------+ +| id | int | Yes | true | NULL | | +| name | text | Yes | false | NULL | NONE | ++-------+------+------+-------+---------+-------+ ``` - -### Keywords - - query, table-valued-function, tvf - -### Best Prac Transparent query for tables in jdbc catalog data source ```sql select * from query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text +------+---------+ | id | name | +------+---------+ @@ -86,7 +79,11 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.student"); | 2 | bob | | 3 | jack | +------+---------+ +``` +```sql select * from query("catalog" = "jdbc", "query" = "select * from test.score"); +``` +```text +------+---------+ | id | score | +------+---------+ @@ -100,6 +97,8 @@ Transparent join query for tables in jdbc catalog data source ```sql 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"); +``` +``` +------+---------+---------+ | id | name | score | +------+---------+---------+ diff --git a/versioned_docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md b/versioned_docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md index f3f0adfd5f2a3..f26d9c0d3de36 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md +++ b/versioned_docs/version-3.0/sql-manual/sql-functions/table-valued-functions/query.md @@ -24,61 +24,54 @@ specific language governing permissions and limitations under the License. --> -## query - -### Name - -query - -### description +## Description Query table function (table-valued-function, tvf) can be used to transparently transmit query statements directly to a catalog for data query -:::info note Supported by Doris version 2.1.3, currently only transparent query jdbc catalog is supported. You need to create the corresponding catalog in Doris first. -::: -#### syntax + +## Syntax ```sql -query( - "catalog" = "catalog_name", - "query" = "select * from db_name.table_name where condition" +QUERY( + "catalog" = "", + "query" = "" ); ``` -**Parameter Description** - +## Required Parameters Each parameter in the query table function tvf is a `"key"="value"` pair. -Related parameters: -- `catalog`: (required) catalog name, which needs to be filled in according to the name of the catalog. -- `query`: (required) The query statement to be executed. -### Example +| Field | Description | +|------------|--------------------------------------------| +| `catalog` | Catalog name, which needs to be filled in according to the name of the catalog. | +| `query` | The query statement to be executed. | -Use the query function to query tables in the jdbc data source -```sql -select * from query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); -``` +## Examples Can be used with `desc function` ```sql -desc function query("catalog" = "jdbc", "query" = "select * from db_name.table_name where condition"); +desc function query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text ++-------+------+------+-------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+-------+---------+-------+ +| id | int | Yes | true | NULL | | +| name | text | Yes | false | NULL | NONE | ++-------+------+------+-------+---------+-------+ ``` - -### Keywords - - query, table-valued-function, tvf - -### Best Prac Transparent query for tables in jdbc catalog data source ```sql select * from query("catalog" = "jdbc", "query" = "select * from test.student"); +``` +```text +------+---------+ | id | name | +------+---------+ @@ -86,7 +79,11 @@ select * from query("catalog" = "jdbc", "query" = "select * from test.student"); | 2 | bob | | 3 | jack | +------+---------+ +``` +```sql select * from query("catalog" = "jdbc", "query" = "select * from test.score"); +``` +```text +------+---------+ | id | score | +------+---------+ @@ -100,6 +97,8 @@ Transparent join query for tables in jdbc catalog data source ```sql 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"); +``` +``` +------+---------+---------+ | id | name | score | +------+---------+---------+