This is an automated email from the ASF dual-hosted git repository. kassiez pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 089e3c7baad [improve](docs)Improve type casting documentation clarity and example (#1926) 089e3c7baad is described below commit 089e3c7baad42b0cd72977d9dc7f7ed419d61e6d Author: Petrichor <1401597...@qq.com> AuthorDate: Thu Feb 6 14:46:41 2025 +0800 [improve](docs)Improve type casting documentation clarity and example (#1926) ## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [ ] Checked by AI - [ ] Test Cases Built --- .../sql-statements/types/SHOW-DATA-TYPES.md | 68 +++++++++++++--- .../sql-statements/types/SHOW-TYPECAST.md | 85 ++++++++++++++------ .../sql-statements/types/SHOW-DATA-TYPES.md | 62 ++++++++++++--- .../sql-statements/types/SHOW-TYPECAST.md | 85 ++++++++++++++------ .../sql-statements/types/SHOW-DATA-TYPES.md | 64 ++++++++++++--- .../sql-statements/types/SHOW-TYPECAST.md | 91 +++++++++++++++------ .../sql-statements/types/SHOW-DATA-TYPES.md | 62 ++++++++++++--- .../sql-statements/types/SHOW-TYPECAST.md | 89 +++++++++++++++------ .../sql-statements/types/SHOW-DATA-TYPES.md | 63 ++++++++++++--- .../sql-statements/types/SHOW-TYPECAST.md | 92 +++++++++++++++------- .../sql-statements/types/SHOW-DATA-TYPES.md | 68 +++++++++++++--- .../sql-statements/types/SHOW-TYPECAST.md | 85 ++++++++++++++------ 12 files changed, 688 insertions(+), 226 deletions(-) diff --git a/docs/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md b/docs/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md index 782dd96dc30..703d0f0be01 100644 --- a/docs/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md +++ b/docs/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW DATA TYPES", - "language": "en" + "title": "SHOW DATA TYPES", + "language": "en" } --- @@ -24,24 +24,66 @@ specific language governing permissions and limitations under the License. --> - ## Description This statement is used to view all supported data types. - grammar: - ```sql - SHOW DATA TYPES; - ``` +## Syntax -## Example +```sql +SHOW DATA TYPES; +``` + +## Return Value - 1. Display all supported data types +| Column Name | Description | +|-------------|------------------| +| TypeName | Name of the type | +| Size | Size in bytes | - SHOW DATA TYPES; +## Access Control Requirements + +The user executing this SQL command does not require specific privileges. + +## Example -## Keywords +- Display all supported data types - SHOW,DATA,TYPES + ```sql + SHOW DATA TYPES; + ``` + ```text + +----------------+------+ + | TypeName | Size | + +----------------+------+ + | AGG_STATE | 16 | + | ARRAY | 32 | + | BIGINT | 8 | + | BITMAP | 16 | + | BOOLEAN | 1 | + | CHAR | 16 | + | DATE | 16 | + | DATETIME | 16 | + | DATETIMEV2 | 8 | + | DATEV2 | 4 | + | DECIMAL128 | 16 | + | DECIMAL32 | 4 | + | DECIMAL64 | 8 | + | DECIMALV2 | 16 | + | DOUBLE | 8 | + | FLOAT | 4 | + | HLL | 16 | + | INT | 4 | + | IPV4 | 4 | + | IPV6 | 16 | + | JSON | 16 | + | LARGEINT | 16 | + | MAP | 24 | + | QUANTILE_STATE | 16 | + | SMALLINT | 2 | + | STRING | 16 | + | TINYINT | 1 | + | VARCHAR | 16 | + +----------------+------+ + ``` -## Best Practice diff --git a/docs/sql-manual/sql-statements/types/SHOW-TYPECAST.md b/docs/sql-manual/sql-statements/types/SHOW-TYPECAST.md index bc39111f553..69765d15a74 100644 --- a/docs/sql-manual/sql-statements/types/SHOW-TYPECAST.md +++ b/docs/sql-manual/sql-statements/types/SHOW-TYPECAST.md @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -24,43 +24,78 @@ specific language governing permissions and limitations under the License. --> - ## Description -View all type cast under the database. If the user specifies a database, then view the corresponding database, otherwise directly query the database where the current session is located - -Requires `SHOW` permission on this database +View all type cast under the database. If the user specifies a database, then view the corresponding database, otherwise +directly query the database where the current session is located ## Syntax ```sql -SHOW TYPE_CAST [IN|FROM db] +SHOW TYPE_CAST [ { IN | FROM } <db>] ``` - Parameters +## Required Parameters ->`db`: database name to query +**1. `<db>`** -## Example +The name of the database to query. -```sql -mysql> show type_cast in testDb\G -**************************** 1. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 2. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 3. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 - -3 rows in set (0.00 sec) -``` +## Return Value + +| Column Name | Description | +|-------------|-----------------| +| Origin Type | Original Type | +| Cast Type | Conversion Type | -## Keywords +## Access Control Requirements -SHOW, TYPECAST +The user executing this SQL command must have at least the following privileges: + +| Privilege | Object | Notes | +|-------------|---------------|--------------------------------------------------------------------------------------------------| +| `Select_priv` | Database (DB) | The user or role must have `Select_priv` on the DB to view all type conversions under the database | + +## Usage Notes + +If a database is specified by the user, the system will query the specified database; otherwise, it will query the +database associated with the current session by default. + +## Example +- View all type casts in database TESTDB + + ```sql + SHOW TYPE_CAST IN TESTDB; + ``` + ```text + +----------------+----------------+ + | Origin Type | Cast Type | + +----------------+----------------+ + | DATETIMEV2 | BOOLEAN | + | DATETIMEV2 | TINYINT | + | DATETIMEV2 | SMALLINT | + | DATETIMEV2 | INT | + | DATETIMEV2 | BIGINT | + | DATETIMEV2 | LARGEINT | + | DATETIMEV2 | FLOAT | + | DATETIMEV2 | DOUBLE | + | DATETIMEV2 | DATE | + | DATETIMEV2 | DATETIME | + | DATETIMEV2 | DATEV2 | + | DATETIMEV2 | DATETIMEV2 | + | DATETIMEV2 | DECIMALV2 | + | DATETIMEV2 | DECIMAL32 | + | DATETIMEV2 | DECIMAL64 | + | DATETIMEV2 | DECIMAL128 | + | DATETIMEV2 | DECIMAL256 | + | DATETIMEV2 | VARCHAR | + | DATETIMEV2 | STRING | + | DECIMAL256 | DECIMAL128 | + | DECIMAL256 | DECIMAL256 | + | DECIMAL256 | VARCHAR | + | DECIMAL256 | STRING | + +----------------+----------------+ + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md index d183ba5e994..9e278fb5d99 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW DATA TYPES", - "language": "zh-CN" + "title": "SHOW DATA TYPES", + "language": "zh-CN" } --- @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -24,25 +24,65 @@ specific language governing permissions and limitations under the License. --> - - ## 描述 该语句用于查看 DORIS 支持的所有数据类型。 -### 语法 +## 语法 ```sql SHOW DATA TYPES; ``` -## 示例 +## 返回值 -1. 查看 Doris 支持的所有数据类型 +| 列名 | 说明 | +|----------|------| +| TypeName | 类型名称 | +| Size | 字节大小 | - SHOW DATA TYPES; +## 权限控制 -## 关键词 +执行此 SQL 命令的用户不需要具有特定的权限 + +## 示例 -SHOW,DATA,TYPES +- 查看 Doris 支持的所有数据类型 + ```sql + SHOW DATA TYPES; + ``` + ```text + +----------------+------+ + | TypeName | Size | + +----------------+------+ + | AGG_STATE | 16 | + | ARRAY | 32 | + | BIGINT | 8 | + | BITMAP | 16 | + | BOOLEAN | 1 | + | CHAR | 16 | + | DATE | 16 | + | DATETIME | 16 | + | DATETIMEV2 | 8 | + | DATEV2 | 4 | + | DECIMAL128 | 16 | + | DECIMAL32 | 4 | + | DECIMAL64 | 8 | + | DECIMALV2 | 16 | + | DOUBLE | 8 | + | FLOAT | 4 | + | HLL | 16 | + | INT | 4 | + | IPV4 | 4 | + | IPV6 | 16 | + | JSON | 16 | + | LARGEINT | 16 | + | MAP | 24 | + | QUANTILE_STATE | 16 | + | SMALLINT | 2 | + | STRING | 16 | + | TINYINT | 1 | + | VARCHAR | 16 | + +----------------+------+ + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-TYPECAST.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-TYPECAST.md index 4eac4272ba0..42f252b76c3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-TYPECAST.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-statements/types/SHOW-TYPECAST.md @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -27,40 +27,79 @@ under the License. ## 描述 -查看数据库下所有的类型转换。如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库 +查看数据库下所有的类型转换。 -需要对这个数据库拥有 `SHOW` 权限 -## 语法 +# 语法 ```sql -SHOW TYPE_CAST [IN|FROM db] +SHOW TYPE_CAST [ IN | FROM <db>]; ``` -参数: +## 必选参数 -`db`: database name to query +**1. `<db>`** + +查询的数据库名称 + +## 返回值 + +| 列名 | 说明 | +|-------------|--------------| +| Origin Type | 原始类型 | +| Cast Type | 转换类型 | + + +## 权限控制 + +执行此 SQL 命令的用户必须至少具有以下权限: + +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +| :---------------- |:-----------|:------------------------------| +| Select_priv | 库(DB) | 用户或者角色对于 DB 拥护 Select_Priv 才能查看数据库下所有类型的转换 | + + +## 注意事项 + +- 如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库 ## 示例 -```sql -mysql> show type_cast in testDb\G -**************************** 1. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 2. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 3. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 - -3 rows in set (0.00 sec) -``` +- 查看数据库 TESTDB 下所有的类型转换 + ```sql + SHOW TYPE_CAST IN TESTDB; + ``` + ```text + +----------------+----------------+ + | Origin Type | Cast Type | + +----------------+----------------+ + | DATETIMEV2 | BOOLEAN | + | DATETIMEV2 | TINYINT | + | DATETIMEV2 | SMALLINT | + | DATETIMEV2 | INT | + | DATETIMEV2 | BIGINT | + | DATETIMEV2 | LARGEINT | + | DATETIMEV2 | FLOAT | + | DATETIMEV2 | DOUBLE | + | DATETIMEV2 | DATE | + | DATETIMEV2 | DATETIME | + | DATETIMEV2 | DATEV2 | + | DATETIMEV2 | DATETIMEV2 | + | DATETIMEV2 | DECIMALV2 | + | DATETIMEV2 | DECIMAL32 | + | DATETIMEV2 | DECIMAL64 | + | DATETIMEV2 | DECIMAL128 | + | DATETIMEV2 | DECIMAL256 | + | DATETIMEV2 | VARCHAR | + | DATETIMEV2 | STRING | + | DECIMAL256 | DECIMAL128 | + | DECIMAL256 | DECIMAL256 | + | DECIMAL256 | VARCHAR | + | DECIMAL256 | STRING | + +----------------+----------------+ + ``` -## 关键词 -SHOW, TYPECAST diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md index 98fd029df23..9e278fb5d99 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW DATA TYPES", - "language": "zh-CN" + "title": "SHOW DATA TYPES", + "language": "zh-CN" } --- @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -24,27 +24,65 @@ specific language governing permissions and limitations under the License. --> - - - ## 描述 该语句用于查看 DORIS 支持的所有数据类型。 -语法: +## 语法 ```sql SHOW DATA TYPES; ``` -## 示例 +## 返回值 -1. 查看 Doris 支持的所有数据类型 +| 列名 | 说明 | +|----------|------| +| TypeName | 类型名称 | +| Size | 字节大小 | - `SHOW DATA TYPES;` +## 权限控制 -## 关键词 +执行此 SQL 命令的用户不需要具有特定的权限 - SHOW,DATA,TYPES +## 示例 -## 最佳实践 +- 查看 Doris 支持的所有数据类型 + + ```sql + SHOW DATA TYPES; + ``` + ```text + +----------------+------+ + | TypeName | Size | + +----------------+------+ + | AGG_STATE | 16 | + | ARRAY | 32 | + | BIGINT | 8 | + | BITMAP | 16 | + | BOOLEAN | 1 | + | CHAR | 16 | + | DATE | 16 | + | DATETIME | 16 | + | DATETIMEV2 | 8 | + | DATEV2 | 4 | + | DECIMAL128 | 16 | + | DECIMAL32 | 4 | + | DECIMAL64 | 8 | + | DECIMALV2 | 16 | + | DOUBLE | 8 | + | FLOAT | 4 | + | HLL | 16 | + | INT | 4 | + | IPV4 | 4 | + | IPV6 | 16 | + | JSON | 16 | + | LARGEINT | 16 | + | MAP | 24 | + | QUANTILE_STATE | 16 | + | SMALLINT | 2 | + | STRING | 16 | + | TINYINT | 1 | + | VARCHAR | 16 | + +----------------+------+ + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md index d8bb1c2b2b7..e33989d2ec0 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW TYPECAST", - "language": "zh-CN" + "title": "SHOW TYPECAST", + "language": "zh-CN" } --- @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -27,40 +27,79 @@ under the License. ## 描述 -查看数据库下所有的类型转换。如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库 +查看数据库下所有的类型转换。 -需要对这个数据库拥有 `SHOW` 权限 -语法 +# 语法 ```sql -SHOW TYPE_CAST [IN|FROM db] +SHOW TYPE_CAST [ IN | FROM <db>]; ``` -Parameters +## 必选参数 -`db`: database name to query +**1. `<db>`** + +查询的数据库名称 + +## 返回值 + +| 列名 | 说明 | +|-------------|--------------| +| Origin Type | 原始类型 | +| Cast Type | 转换类型 | + + +## 权限控制 + +执行此 SQL 命令的用户必须至少具有以下权限: + +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +| :---------------- |:-----------|:------------------------------| +| Select_priv | 库(DB) | 用户或者角色对于 DB 拥护 Select_Priv 才能查看数据库下所有类型的转换 | + + +## 注意事项 + +- 如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库 ## 示例 -```sql -mysql> show type_cast in testDb\G -**************************** 1. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 2. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 3. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 - -3 rows in set (0.00 sec) -``` +- 查看数据库 TESTDB 下所有的类型转换 + ```sql + SHOW TYPE_CAST IN TESTDB; + ``` + ```text + +----------------+----------------+ + | Origin Type | Cast Type | + +----------------+----------------+ + | DATETIMEV2 | BOOLEAN | + | DATETIMEV2 | TINYINT | + | DATETIMEV2 | SMALLINT | + | DATETIMEV2 | INT | + | DATETIMEV2 | BIGINT | + | DATETIMEV2 | LARGEINT | + | DATETIMEV2 | FLOAT | + | DATETIMEV2 | DOUBLE | + | DATETIMEV2 | DATE | + | DATETIMEV2 | DATETIME | + | DATETIMEV2 | DATEV2 | + | DATETIMEV2 | DATETIMEV2 | + | DATETIMEV2 | DECIMALV2 | + | DATETIMEV2 | DECIMAL32 | + | DATETIMEV2 | DECIMAL64 | + | DATETIMEV2 | DECIMAL128 | + | DATETIMEV2 | DECIMAL256 | + | DATETIMEV2 | VARCHAR | + | DATETIMEV2 | STRING | + | DECIMAL256 | DECIMAL128 | + | DECIMAL256 | DECIMAL256 | + | DECIMAL256 | VARCHAR | + | DECIMAL256 | STRING | + +----------------+----------------+ + ``` + -## 关键词 - SHOW, TYPECAST -## 最佳实践 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md index d183ba5e994..9e278fb5d99 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW DATA TYPES", - "language": "zh-CN" + "title": "SHOW DATA TYPES", + "language": "zh-CN" } --- @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -24,25 +24,65 @@ specific language governing permissions and limitations under the License. --> - - ## 描述 该语句用于查看 DORIS 支持的所有数据类型。 -### 语法 +## 语法 ```sql SHOW DATA TYPES; ``` -## 示例 +## 返回值 -1. 查看 Doris 支持的所有数据类型 +| 列名 | 说明 | +|----------|------| +| TypeName | 类型名称 | +| Size | 字节大小 | - SHOW DATA TYPES; +## 权限控制 -## 关键词 +执行此 SQL 命令的用户不需要具有特定的权限 + +## 示例 -SHOW,DATA,TYPES +- 查看 Doris 支持的所有数据类型 + ```sql + SHOW DATA TYPES; + ``` + ```text + +----------------+------+ + | TypeName | Size | + +----------------+------+ + | AGG_STATE | 16 | + | ARRAY | 32 | + | BIGINT | 8 | + | BITMAP | 16 | + | BOOLEAN | 1 | + | CHAR | 16 | + | DATE | 16 | + | DATETIME | 16 | + | DATETIMEV2 | 8 | + | DATEV2 | 4 | + | DECIMAL128 | 16 | + | DECIMAL32 | 4 | + | DECIMAL64 | 8 | + | DECIMALV2 | 16 | + | DOUBLE | 8 | + | FLOAT | 4 | + | HLL | 16 | + | INT | 4 | + | IPV4 | 4 | + | IPV6 | 16 | + | JSON | 16 | + | LARGEINT | 16 | + | MAP | 24 | + | QUANTILE_STATE | 16 | + | SMALLINT | 2 | + | STRING | 16 | + | TINYINT | 1 | + | VARCHAR | 16 | + +----------------+------+ + ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md index 4eac4272ba0..e33989d2ec0 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW TYPECAST", - "language": "zh-CN" + "title": "SHOW TYPECAST", + "language": "zh-CN" } --- @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -27,40 +27,79 @@ under the License. ## 描述 -查看数据库下所有的类型转换。如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库 +查看数据库下所有的类型转换。 -需要对这个数据库拥有 `SHOW` 权限 -## 语法 +# 语法 ```sql -SHOW TYPE_CAST [IN|FROM db] +SHOW TYPE_CAST [ IN | FROM <db>]; ``` -参数: +## 必选参数 -`db`: database name to query +**1. `<db>`** + +查询的数据库名称 + +## 返回值 + +| 列名 | 说明 | +|-------------|--------------| +| Origin Type | 原始类型 | +| Cast Type | 转换类型 | + + +## 权限控制 + +执行此 SQL 命令的用户必须至少具有以下权限: + +| 权限(Privilege) | 对象(Object) | 说明(Notes) | +| :---------------- |:-----------|:------------------------------| +| Select_priv | 库(DB) | 用户或者角色对于 DB 拥护 Select_Priv 才能查看数据库下所有类型的转换 | + + +## 注意事项 + +- 如果用户指定了数据库,那么查看对应数据库的,否则直接查询当前会话所在数据库 ## 示例 -```sql -mysql> show type_cast in testDb\G -**************************** 1. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 2. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 3. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 - -3 rows in set (0.00 sec) -``` +- 查看数据库 TESTDB 下所有的类型转换 + ```sql + SHOW TYPE_CAST IN TESTDB; + ``` + ```text + +----------------+----------------+ + | Origin Type | Cast Type | + +----------------+----------------+ + | DATETIMEV2 | BOOLEAN | + | DATETIMEV2 | TINYINT | + | DATETIMEV2 | SMALLINT | + | DATETIMEV2 | INT | + | DATETIMEV2 | BIGINT | + | DATETIMEV2 | LARGEINT | + | DATETIMEV2 | FLOAT | + | DATETIMEV2 | DOUBLE | + | DATETIMEV2 | DATE | + | DATETIMEV2 | DATETIME | + | DATETIMEV2 | DATEV2 | + | DATETIMEV2 | DATETIMEV2 | + | DATETIMEV2 | DECIMALV2 | + | DATETIMEV2 | DECIMAL32 | + | DATETIMEV2 | DECIMAL64 | + | DATETIMEV2 | DECIMAL128 | + | DATETIMEV2 | DECIMAL256 | + | DATETIMEV2 | VARCHAR | + | DATETIMEV2 | STRING | + | DECIMAL256 | DECIMAL128 | + | DECIMAL256 | DECIMAL256 | + | DECIMAL256 | VARCHAR | + | DECIMAL256 | STRING | + +----------------+----------------+ + ``` -## 关键词 -SHOW, TYPECAST diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md b/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md index ff681991ae8..703d0f0be01 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW DATA TYPES", - "language": "en" + "title": "SHOW DATA TYPES", + "language": "en" } --- @@ -24,27 +24,66 @@ specific language governing permissions and limitations under the License. --> - - - ## Description -This statement is used to view all supported data types. + This statement is used to view all supported data types. -## Syntax: +## Syntax ```sql SHOW DATA TYPES; ``` -## Example +## Return Value -1. Display all supported data types +| Column Name | Description | +|-------------|------------------| +| TypeName | Name of the type | +| Size | Size in bytes | - `SHOW DATA TYPES` +## Access Control Requirements -## Keywords +The user executing this SQL command does not require specific privileges. -SHOW,DATA,TYPES +## Example +- Display all supported data types + + ```sql + SHOW DATA TYPES; + ``` + ```text + +----------------+------+ + | TypeName | Size | + +----------------+------+ + | AGG_STATE | 16 | + | ARRAY | 32 | + | BIGINT | 8 | + | BITMAP | 16 | + | BOOLEAN | 1 | + | CHAR | 16 | + | DATE | 16 | + | DATETIME | 16 | + | DATETIMEV2 | 8 | + | DATEV2 | 4 | + | DECIMAL128 | 16 | + | DECIMAL32 | 4 | + | DECIMAL64 | 8 | + | DECIMALV2 | 16 | + | DOUBLE | 8 | + | FLOAT | 4 | + | HLL | 16 | + | INT | 4 | + | IPV4 | 4 | + | IPV6 | 16 | + | JSON | 16 | + | LARGEINT | 16 | + | MAP | 24 | + | QUANTILE_STATE | 16 | + | SMALLINT | 2 | + | STRING | 16 | + | TINYINT | 1 | + | VARCHAR | 16 | + +----------------+------+ + ``` diff --git a/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md b/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md index e93ae7ccec0..69765d15a74 100644 --- a/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md +++ b/versioned_docs/version-2.1/sql-manual/sql-statements/types/SHOW-TYPECAST.md @@ -1,11 +1,11 @@ --- { - "title": "SHOW TYPECAST", - "language": "en" + "title": "SHOW TYPECAST", + "language": "zh-CN" } --- -<!-- +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -24,44 +24,78 @@ specific language governing permissions and limitations under the License. --> - - ## Description -View all type cast under the database. If the user specifies a database, then view the corresponding database, otherwise directly query the database where the current session is located - -Requires `SHOW` permission on this database +View all type cast under the database. If the user specifies a database, then view the corresponding database, otherwise +directly query the database where the current session is located ## Syntax ```sql -SHOW TYPE_CAST [IN|FROM db] +SHOW TYPE_CAST [ { IN | FROM } <db>] ``` - Parameters +## Required Parameters ->`db`: database name to query +**1. `<db>`** -## Example +The name of the database to query. -```sql -mysql> show type_cast in testDb\G -**************************** 1. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 2. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 3. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 - -3 rows in set (0.00 sec) -``` +## Return Value -## Keywords +| Column Name | Description | +|-------------|-----------------| +| Origin Type | Original Type | +| Cast Type | Conversion Type | -SHOW, TYPECAST +## Access Control Requirements + +The user executing this SQL command must have at least the following privileges: + +| Privilege | Object | Notes | +|-------------|---------------|--------------------------------------------------------------------------------------------------| +| `Select_priv` | Database (DB) | The user or role must have `Select_priv` on the DB to view all type conversions under the database | + +## Usage Notes + +If a database is specified by the user, the system will query the specified database; otherwise, it will query the +database associated with the current session by default. + +## Example +- View all type casts in database TESTDB + + ```sql + SHOW TYPE_CAST IN TESTDB; + ``` + ```text + +----------------+----------------+ + | Origin Type | Cast Type | + +----------------+----------------+ + | DATETIMEV2 | BOOLEAN | + | DATETIMEV2 | TINYINT | + | DATETIMEV2 | SMALLINT | + | DATETIMEV2 | INT | + | DATETIMEV2 | BIGINT | + | DATETIMEV2 | LARGEINT | + | DATETIMEV2 | FLOAT | + | DATETIMEV2 | DOUBLE | + | DATETIMEV2 | DATE | + | DATETIMEV2 | DATETIME | + | DATETIMEV2 | DATEV2 | + | DATETIMEV2 | DATETIMEV2 | + | DATETIMEV2 | DECIMALV2 | + | DATETIMEV2 | DECIMAL32 | + | DATETIMEV2 | DECIMAL64 | + | DATETIMEV2 | DECIMAL128 | + | DATETIMEV2 | DECIMAL256 | + | DATETIMEV2 | VARCHAR | + | DATETIMEV2 | STRING | + | DECIMAL256 | DECIMAL128 | + | DECIMAL256 | DECIMAL256 | + | DECIMAL256 | VARCHAR | + | DECIMAL256 | STRING | + +----------------+----------------+ + ``` diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md b/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md index 782dd96dc30..703d0f0be01 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-DATA-TYPES.md @@ -1,7 +1,7 @@ --- { - "title": "SHOW DATA TYPES", - "language": "en" + "title": "SHOW DATA TYPES", + "language": "en" } --- @@ -24,24 +24,66 @@ specific language governing permissions and limitations under the License. --> - ## Description This statement is used to view all supported data types. - grammar: - ```sql - SHOW DATA TYPES; - ``` +## Syntax -## Example +```sql +SHOW DATA TYPES; +``` + +## Return Value - 1. Display all supported data types +| Column Name | Description | +|-------------|------------------| +| TypeName | Name of the type | +| Size | Size in bytes | - SHOW DATA TYPES; +## Access Control Requirements + +The user executing this SQL command does not require specific privileges. + +## Example -## Keywords +- Display all supported data types - SHOW,DATA,TYPES + ```sql + SHOW DATA TYPES; + ``` + ```text + +----------------+------+ + | TypeName | Size | + +----------------+------+ + | AGG_STATE | 16 | + | ARRAY | 32 | + | BIGINT | 8 | + | BITMAP | 16 | + | BOOLEAN | 1 | + | CHAR | 16 | + | DATE | 16 | + | DATETIME | 16 | + | DATETIMEV2 | 8 | + | DATEV2 | 4 | + | DECIMAL128 | 16 | + | DECIMAL32 | 4 | + | DECIMAL64 | 8 | + | DECIMALV2 | 16 | + | DOUBLE | 8 | + | FLOAT | 4 | + | HLL | 16 | + | INT | 4 | + | IPV4 | 4 | + | IPV6 | 16 | + | JSON | 16 | + | LARGEINT | 16 | + | MAP | 24 | + | QUANTILE_STATE | 16 | + | SMALLINT | 2 | + | STRING | 16 | + | TINYINT | 1 | + | VARCHAR | 16 | + +----------------+------+ + ``` -## Best Practice diff --git a/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md b/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md index bc39111f553..69765d15a74 100644 --- a/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md +++ b/versioned_docs/version-3.0/sql-manual/sql-statements/types/SHOW-TYPECAST.md @@ -14,7 +14,7 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -24,43 +24,78 @@ specific language governing permissions and limitations under the License. --> - ## Description -View all type cast under the database. If the user specifies a database, then view the corresponding database, otherwise directly query the database where the current session is located - -Requires `SHOW` permission on this database +View all type cast under the database. If the user specifies a database, then view the corresponding database, otherwise +directly query the database where the current session is located ## Syntax ```sql -SHOW TYPE_CAST [IN|FROM db] +SHOW TYPE_CAST [ { IN | FROM } <db>] ``` - Parameters +## Required Parameters ->`db`: database name to query +**1. `<db>`** -## Example +The name of the database to query. -```sql -mysql> show type_cast in testDb\G -**************************** 1. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 2. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 -**************************** 3. row ******************** ****** -Origin Type: TIMEV2 - Cast Type: TIMEV2 - -3 rows in set (0.00 sec) -``` +## Return Value + +| Column Name | Description | +|-------------|-----------------| +| Origin Type | Original Type | +| Cast Type | Conversion Type | -## Keywords +## Access Control Requirements -SHOW, TYPECAST +The user executing this SQL command must have at least the following privileges: + +| Privilege | Object | Notes | +|-------------|---------------|--------------------------------------------------------------------------------------------------| +| `Select_priv` | Database (DB) | The user or role must have `Select_priv` on the DB to view all type conversions under the database | + +## Usage Notes + +If a database is specified by the user, the system will query the specified database; otherwise, it will query the +database associated with the current session by default. + +## Example +- View all type casts in database TESTDB + + ```sql + SHOW TYPE_CAST IN TESTDB; + ``` + ```text + +----------------+----------------+ + | Origin Type | Cast Type | + +----------------+----------------+ + | DATETIMEV2 | BOOLEAN | + | DATETIMEV2 | TINYINT | + | DATETIMEV2 | SMALLINT | + | DATETIMEV2 | INT | + | DATETIMEV2 | BIGINT | + | DATETIMEV2 | LARGEINT | + | DATETIMEV2 | FLOAT | + | DATETIMEV2 | DOUBLE | + | DATETIMEV2 | DATE | + | DATETIMEV2 | DATETIME | + | DATETIMEV2 | DATEV2 | + | DATETIMEV2 | DATETIMEV2 | + | DATETIMEV2 | DECIMALV2 | + | DATETIMEV2 | DECIMAL32 | + | DATETIMEV2 | DECIMAL64 | + | DATETIMEV2 | DECIMAL128 | + | DATETIMEV2 | DECIMAL256 | + | DATETIMEV2 | VARCHAR | + | DATETIMEV2 | STRING | + | DECIMAL256 | DECIMAL128 | + | DECIMAL256 | DECIMAL256 | + | DECIMAL256 | VARCHAR | + | DECIMAL256 | STRING | + +----------------+----------------+ + ``` --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org