This is an automated email from the ASF dual-hosted git repository.
mrhhsg 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 adea55dfe7e update map doc (#2676)
adea55dfe7e is described below
commit adea55dfe7ee2f3545055bc09b2bf7aca685c3af
Author: Jerry Hu <[email protected]>
AuthorDate: Fri Sep 12 20:03:20 2025 +0800
update map doc (#2676)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../map-functions/map-contains-key.md | 19 ++---
.../map-functions/map-contains-value.md | 64 ++++++++++------
.../scalar-functions/map-functions/map-keys.md | 48 +++++++-----
.../scalar-functions/map-functions/map-size.md | 50 +++++++-----
.../scalar-functions/map-functions/map-values.md | 54 ++++++++-----
.../scalar-functions/map-functions/map.md | 89 ++++++++++++++--------
.../scalar-functions/map-functions/str-to-map.md | 9 +--
.../sql-data-types/semi-structured/MAP.md | 3 +
.../map-functions/map-contains-key.md | 8 +-
.../map-functions/map-contains-value.md | 56 +++++++++-----
.../scalar-functions/map-functions/map-keys.md | 44 ++++++-----
.../scalar-functions/map-functions/map-size.md | 46 ++++++-----
.../scalar-functions/map-functions/map-values.md | 48 +++++++-----
.../scalar-functions/map-functions/map.md | 88 +++++++++++++--------
.../scalar-functions/map-functions/str-to-map.md | 8 +-
15 files changed, 385 insertions(+), 249 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
index 1ceaeccd57d..1dc719de89d 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
@@ -7,7 +7,7 @@
## Description
-Determines whether the given `map` contains a specific key `key`
+Determines whether a given `map` contains a specific key `key`
## Syntax
@@ -16,17 +16,13 @@ MAP_CONTAINS_KEY(<map>, <key>)
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<map>` | Input map content |
-| `<key>` | The key to be retrieved |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) type, the
input map content.
+- `<key>` Key type supported by
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md), the key
to be searched.
## Return Value
+Determines whether a given `map` contains a specific key `key`, returns 1 if
it exists, returns 0 if it does not exist.
-Determines whether the given `map` contains a specific key `key`, and returns
1 if it exists, otherwise returns 0.
-
-## Example
+## Examples
```sql
select map_contains_key(map(null, 1, 2, null), null),map_contains_key(map(1,
"100", 0.1, 2), 0.11);
@@ -39,7 +35,7 @@ select map_contains_key(map(null, 1, 2, null),
null),map_contains_key(map(1, "10
| 1 |
0 |
+-----------------------------------------------+-----------------------------------------------+
```
-* Key comparison in maps uses "null-safe equal" (null and null are considered
equal), which differs from the standard SQL definition.
+> Key comparison in Map uses "null-safe equal" (null and null are considered
equal), which is different from
```sql
select map_contains_key(map(null,1), null);
@@ -49,5 +45,4 @@ select map_contains_key(map(null,1), null);
| map_contains_key(map(null,1), null) |
+-------------------------------------+
| 1 |
-+-------------------------------------+
-```
++-------------------------------------+
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
index 495164bf610..04c0a36a9f2 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
@@ -7,7 +7,7 @@
## Description
-Determines whether the given `map` contains a specific value `value`
+Determines whether a given `map` contains a specific value `value`
## Syntax
@@ -16,26 +16,46 @@ MAP_CONTAINS_VALUE(<map>, <value>)
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<map>` | Input map content |
-| `<value>` | The value to be retrieved |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) type, the
input map content.
+- `<value>` supports multiple types, the value to be searched.
## Return Value
-
-Determines whether the given `map` contains a specific value `value`, and
returns 1 if it exists, otherwise returns 0.
-
-## Example
-
-```sql
-select map_contains_value(map(null, 1, 2, null),
null),map_contains_value(map(1, "100", 0.1, 2), 101);
-```
-
-```text
-+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
-| map_contains_value(map(NULL, 1, 2, NULL), NULL) |
map_contains_value(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1 as
DECIMALV3(2, 1)), cast(2 as TEXT)), cast(101 as VARCHAR(3))) |
-+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
-| 1 |
0 |
-+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
-```
+Determines whether a given `map` contains a specific value `value`. Returns 1
if exists, 0 if not exists.
+
+## Usage Notes
+1. If parameter `<map>` is NULL, returns NULL.
+2. `<value>` can be NULL. The comparison for NULL is `null-safe-equal`, which
means NULL is considered equal to NULL.
+
+## Examples
+1. Regular parameters
+ ```sql
+ select map_contains_value(map(1, "100", 0.1, 2), 100),
map_contains_value(map(1, "100", 0.1, 2), 101);
+ ```
+ ```text
+
+------------------------------------------------+------------------------------------------------+
+ | map_contains_value(map(1, "100", 0.1, 2), 100) |
map_contains_value(map(1, "100", 0.1, 2), 101) |
+
+------------------------------------------------+------------------------------------------------+
+ | 1 |
0 |
+
+------------------------------------------------+------------------------------------------------+
+ ```
+2. NULL parameters
+ ```sql
+ select map_contains_value(NULL, 100);
+ ```
+ ```text
+ +-------------------------------+
+ | map_contains_value(NULL, 100) |
+ +-------------------------------+
+ | NULL |
+ +-------------------------------+
+ ```
+ ```sql
+ select map_contains_value(map(null, null), null),
map_contains_value(map(null, 100), null);
+ ```
+ ```text
+
+-------------------------------------------+------------------------------------------+
+ | map_contains_value(map(null, null), null) | map_contains_value(map(null,
100), null) |
+
+-------------------------------------------+------------------------------------------+
+ | 1 |
0 |
+
+-------------------------------------------+------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
index 599c829e7be..0c56e97a5cf 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
@@ -7,7 +7,7 @@
## Description
-Extract the keys of the given `map` into an `ARRAY` of the corresponding type
+Extracts the keys from a given `map` into an
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md) of
the corresponding type.
## Syntax
@@ -16,25 +16,31 @@ MAP_KEYS(<map>)
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<map>` | Input map content |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) type, the
input map content.
## Return Value
-
-Extract the keys of the given `map` into an `ARRAY` of the corresponding type
-
-## Example
-
-```sql
-select map_keys(map()),map_keys(map(1, "100", 0.1, 2));
-```
-
-```text
-+-----------------+-------------------------------------------------------------------------------------------------+
-| map_keys(map()) | map_keys(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1
as DECIMALV3(2, 1)), cast(2 as TEXT))) |
-+-----------------+-------------------------------------------------------------------------------------------------+
-| [] | [1.0, 0.1]
|
-+-----------------+-------------------------------------------------------------------------------------------------+
-```
+Extracts the keys from a given `map` into an
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md) of
the corresponding type.
+
+## Examples
+1. Regular parameters
+ ```sql
+ select map_keys(map()),map_keys(map(1, "100", 0.1, 2, null, null));
+ ```
+ ```text
+ +-----------------+---------------------------------------------+
+ | map_keys(map()) | map_keys(map(1, "100", 0.1, 2, null, null)) |
+ +-----------------+---------------------------------------------+
+ | [] | [1.0, 0.1, null] |
+ +-----------------+---------------------------------------------+
+ ```
+2. NULL parameters
+ ```sql
+ select map_keys(NULL);
+ ```
+ ```text
+ +----------------+
+ | map_keys(NULL) |
+ +----------------+
+ | NULL |
+ +----------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
index df6a9d62782..43c9e625475 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
@@ -7,7 +7,7 @@
## Description
-Count the number of elements in a Map
+Calculates the number of elements in a Map
## Syntax
@@ -16,25 +16,35 @@ MAP_SIZE(<map>)
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<map>` | Input map content |
-
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) type, the
input map content.
## Return Value
-
Returns the number of elements in the Map
-## Example
-
-```sql
-select map_size(map()),map_size(map(1, "100", 0.1, 2));
-```
-
-```text
-+-----------------+-------------------------------------------------------------------------------------------------+
-| map_size(map()) | map_size(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1
as DECIMALV3(2, 1)), cast(2 as TEXT))) |
-+-----------------+-------------------------------------------------------------------------------------------------+
-| 0 |
2 |
-+-----------------+-------------------------------------------------------------------------------------------------+
-```
+## Usage Notes
+1. Both NULL keys and values are counted.
+2. For NULL parameters, returns NULL.
+
+## Examples
+1. Regular parameters
+ ```sql
+ select map_size(map()), map_size(map(1, "100", 0.1, 2, null, null));
+ ```
+
+ ```text
+ +-----------------+---------------------------------------------+
+ | map_size(map()) | map_size(map(1, "100", 0.1, 2, null, null)) |
+ +-----------------+---------------------------------------------+
+ | 0 | 3 |
+ +-----------------+---------------------------------------------+
+ ```
+2. NULL parameters
+ ```sql
+ select map_size(NULL);
+ ```
+ ```text
+ +----------------+
+ | map_size(NULL) |
+ +----------------+
+ | NULL |
+ +----------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
index 792bd2dd3e8..109229950df 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
@@ -7,7 +7,7 @@
## Description
-Extract the values of the given `map` into an `ARRAY` of the corresponding type
+Extracts the values from a given
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) into an
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md) of
the corresponding type.
## Syntax
@@ -16,25 +16,37 @@ MAP_VALUES(<map>)
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<map>` | Input map content |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) type, the
input map content.
## Return Value
-
-Extract the values of the given `map` into an `ARRAY` of the corresponding type
-
-## Example
-
-```sql
-select map_values(map()),map_values(map(1, "100", 0.1, 2));
-```
-
-```text
-+-------------------+---------------------------------------------------------------------------------------------------+
-| map_values(map()) | map_values(map(cast(1 as DECIMALV3(2, 1)), '100',
cast(0.1 as DECIMALV3(2, 1)), cast(2 as TEXT))) |
-+-------------------+---------------------------------------------------------------------------------------------------+
-| [] | ["100", "2"]
|
-+-------------------+---------------------------------------------------------------------------------------------------+
-```
+Extracts the values from a given `map` into an
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md) of
the corresponding type.
+
+## Usage Notes
+1. For NULL parameters, returns NULL.
+2. For empty MAP objects, returns an empty array.
+3. NULL values in the MAP are also included in the returned array.
+
+## Examples
+1. Regular parameters
+ ```sql
+ select map_values(map()), map_values(map(1, "100", 0.1, 2, 0.3, null));
+ ```
+
+ ```text
+ +-------------------+----------------------------------------------+
+ | map_values(map()) | map_values(map(1, "100", 0.1, 2, 0.3, null)) |
+ +-------------------+----------------------------------------------+
+ | [] | ["100", "2", null] |
+ +-------------------+----------------------------------------------+
+ ```
+2. NULL parameters
+ ```sql
+ select map_values(null);
+ ```
+ ```text
+ +------------------+
+ | map_values(null) |
+ +------------------+
+ | NULL |
+ +------------------+
+ ```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map.md
index 0b3dc553fc4..e4ea0fe8178 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/map-functions/map.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/map-functions/map.md
@@ -7,48 +7,73 @@
## Description
-Constructs a [`Map<K,
V>`](../../../basic-element/sql-data-types/semi-structured/MAP.md) of a
specific type using some set of key-value pairs
+Constructs a [`MAP<K,
V>`](../../../basic-element/sql-data-types/semi-structured/MAP.md) of a
specific type using several groups of key-value pairs
## Syntax
```sql
-MAP( <key1> , <value1> [, <key2>,<value2> ... ])
+MAP( <key1> , <value1> [, <key2>, <value2> ... ])
```
## Parameters
-
-| Parameter | Description |
-| -- |-------------------------------------------------|
-| `<key>` | Constructing the key of the map, case sensitive |
-| `<value>` | Constructing the value of the map |
+### Optional Parameters
+- `<key1>` supports multiple types (refer to [`MAP<K,
V>`](../../../basic-element/sql-data-types/semi-structured/MAP.md)) to
construct the key of the map
+- `<value1>` to construct the value of the map
+### Variable Parameters
+Supports multiple groups of key-value parameters
## Return Value
-Returns a specific type `Map<K, V>` constructed from a number of key-value
pairs
-
-## Example
+Returns a specific type `MAP<K, V>` constructed from several groups of
key-value pairs
-```sql
-select map(1, "100", 0.1, 2),map(1, "100", 0.1, 2)[1];
-```
+## Notes
+1. The number of parameters must be even (can be 0), otherwise an error will
be reported.
+2. Key parameters can appear repeatedly, but Doris will remove duplicate keys.
+3. Keys can be NULL, and multiple NULL keys will be deduplicated.
-```text
-+-----------------------+--------------------------+
-| map(1, "100", 0.1, 2) | map(1, "100", 0.1, 2)[1] |
-+-----------------------+--------------------------+
-| {1.0:"100", 0.1:"2"} | 100 |
-+-----------------------+--------------------------+
-```
+## Examples
+1. Regular parameters
+ ```sql
+ select map(1, "100", 0.1, 2),map(1, "100", 0.1, 2)[1];
+ ```
-* If there are duplicate keys, they will be deduplicated:
-```sql
-select map(1, 2, 2, 11, 1, 3);
-```
-```text
-+------------------------+
-| map(1, 2, 2, 11, 1, 3) |
-+------------------------+
-| {2:11, 1:3} |
-+------------------------+
-```
-> There are two sets of parameters with the key 1 (1, 2 and 1, 3), only 1, 3
is retained.
\ No newline at end of file
+ ```text
+ +-----------------------+--------------------------+
+ | map(1, "100", 0.1, 2) | map(1, "100", 0.1, 2)[1] |
+ +-----------------------+--------------------------+
+ | {1.0:"100", 0.1:"2"} | 100 |
+ +-----------------------+--------------------------+
+ ```
+2. No parameters case
+ ```sql
+ select map();
+ ```
+ ```text
+ +-------+
+ | map() |
+ +-------+
+ | {} |
+ +-------+
+ ```
+3. NULL parameters
+ ```sql
+ select map(null, 2, 3, null);
+ ```
+ ```text
+ +-----------------------+
+ | map(null, 2, 3, null) |
+ +-----------------------+
+ | {null:2, 3:null} |
+ +-----------------------+
+ ```
+4. If there are duplicate keys, they will be deduplicated
+ ```sql
+ select map(1, 2, 2, 11, 1, 3, null, "null 1", null, "null 2");
+ ```
+ ```text
+ +--------------------------------------------------------+
+ | map(1, 2, 2, 11, 1, 3, null, "null 1", null, "null 2") |
+ +--------------------------------------------------------+
+ | {2:"11", 1:"3", null:"null 2"} |
+ +--------------------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
b/docs/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
index d2450afd0bd..6f5d066f388 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
@@ -20,12 +20,9 @@ STR_TO_MAP(<str> [, <pair_delimiter> [,
<key_value_delimiter>]])
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to be converted to a map |
-| `<pair_delimiter>` | The delimiter for the pairs in the string, default is
`,` |
-| `<key_value_delimiter>` | The delimiter for the keys and values in the
string, default is `:` |
+- `<str>` The string to be converted to a map.
+- `<pair_delimiter>` The delimiter for the pairs in the string, default is `,`.
+- `<key_value_delimiter>` The delimiter for the keys and values in the string,
default is `:`.
## Return Value
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/semi-structured/MAP.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/semi-structured/MAP.md
index b2aaea826f8..0b9ccd2dc77 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/semi-structured/MAP.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/semi-structured/MAP.md
@@ -10,6 +10,9 @@
- `MAP<key_type, value_type>`类型用于表示键值对集合的复合类型,每个键(key)唯一地对应一个值(value)。
- `key_type` 表征键的类型,支持的类型为`BOOLEAN, TINYINT, SMALLINT, INT, BIGINT,
LARGEINT, FLOAT, DOUBLE, DECIMAL, DATE, DATETIME, CHAR, VARCHAR, STRING,IPTV4,
IPV6`,key值是Nullable的,不支持指定NOT NULL。
- `value_type` 表征值的类型,支持 `BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, LARGEINT,
FLOAT, DOUBLE, DECIMAL, DATE, DATETIME, CHAR, VARCHAR, STRING,IPV4, IPV6,
ARRAY, MAP, STRUCT`,值是 Nullable 的,不支持指定 NOT NULL。
+
+### 语法
+`MAP<K, V>`
## 类型约束
- `MAP<key_type, value_type>`类型允许的最大嵌套深度是9。
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
index 34bf3dac21f..828770de191 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-key.md
@@ -16,14 +16,10 @@ MAP_CONTAINS_KEY(<map>, <key>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<map>` | 输入的 map 内容 |
-| `<key>` | 需要检索的 key |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 类型,输入的
map 内容。
+- `<key>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 支持的 key
类型,需要检索的 key。
## 返回值
-
判断给定 `map` 中是否包含特定的键 `key`,存在返回 1 ,不存在返回 0。
## 举例
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
index 669a86ffc06..2c13d58474b 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-contains-value.md
@@ -16,26 +16,46 @@ MAP_CONTAINS_VALUE(<map>, <value>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<map>` | 输入的 map 内容 |
-| `<value>` | 需要检索的 value |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 类型,输入的
map 内容。
+- `<value>` 支持多种类型,需要检索的 value。
## 返回值
-
判断给定 `map` 中是否包含特定的值 `value`,存在返回 1 ,不存在返回 0。
-## 举例
-
-```sql
-select map_contains_value(map(null, 1, 2, null),
null),map_contains_value(map(1, "100", 0.1, 2), 101);
-```
+## 使用说明
+1. 如果参数 `<map>` 为 NULL,返回 NULL。
+2. `<value>` 可以是 NULL,这里对 NULL 的比较为 `null-safe-equal` 即认为 NULL 和 NULL 是相等的。
-```text
-+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
-| map_contains_value(map(NULL, 1, 2, NULL), NULL) |
map_contains_value(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1 as
DECIMALV3(2, 1)), cast(2 as TEXT)), cast(101 as VARCHAR(3))) |
-+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
-| 1 |
0 |
-+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
-```
+## 举例
+1. 普通参数
+ ```sql
+ select map_contains_value(map(1, "100", 0.1, 2), 100),
map_contains_value(map(1, "100", 0.1, 2), 101);
+ ```
+ ```text
+
+------------------------------------------------+------------------------------------------------+
+ | map_contains_value(map(1, "100", 0.1, 2), 100) |
map_contains_value(map(1, "100", 0.1, 2), 101) |
+
+------------------------------------------------+------------------------------------------------+
+ | 1 |
0 |
+
+------------------------------------------------+------------------------------------------------+
+ ```
+2. NULL 参数
+ ```sql
+ select map_contains_value(NULL, 100);
+ ```
+ ```text
+ +-------------------------------+
+ | map_contains_value(NULL, 100) |
+ +-------------------------------+
+ | NULL |
+ +-------------------------------+
+ ```
+ ```sql
+ select map_contains_value(map(null, null), null),
map_contains_value(map(null, 100), null);
+ ```
+ ```text
+
+-------------------------------------------+------------------------------------------+
+ | map_contains_value(map(null, null), null) | map_contains_value(map(null,
100), null) |
+
+-------------------------------------------+------------------------------------------+
+ | 1 |
0 |
+
+-------------------------------------------+------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
index 1e3e28281a0..031533243bc 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-keys.md
@@ -7,7 +7,7 @@
## 描述
-将给定 `map` 的键提取成一个对应类型的 `ARRAY`
+将给定 `map` 的键提取成一个对应类型的
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md)。
## 语法
@@ -16,25 +16,31 @@ MAP_KEYS(<map>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<map>` | 输入的 map 内容 |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 类型,输入的
map 内容。
## 返回值
-
-将给定 `map` 的键提取成一个对应类型的 `ARRAY`
+将给定 `map` 的键提取成一个对应类型的
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md)。
## 举例
-
-```sql
-select map_keys(map()),map_keys(map(1, "100", 0.1, 2));
-```
-
-```text
-+-----------------+-------------------------------------------------------------------------------------------------+
-| map_keys(map()) | map_keys(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1
as DECIMALV3(2, 1)), cast(2 as TEXT))) |
-+-----------------+-------------------------------------------------------------------------------------------------+
-| [] | [1.0, 0.1]
|
-+-----------------+-------------------------------------------------------------------------------------------------+
-```
+1. 常规参数
+ ```sql
+ select map_keys(map()),map_keys(map(1, "100", 0.1, 2, null, null));
+ ```
+ ```text
+ +-----------------+---------------------------------------------+
+ | map_keys(map()) | map_keys(map(1, "100", 0.1, 2, null, null)) |
+ +-----------------+---------------------------------------------+
+ | [] | [1.0, 0.1, null] |
+ +-----------------+---------------------------------------------+
+ ```
+2. NULL 参数
+ ```sql
+ select map_keys(NULL);
+ ```
+ ```text
+ +----------------+
+ | map_keys(NULL) |
+ +----------------+
+ | NULL |
+ +----------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
index a18375d501f..9c679cf6be7 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-size.md
@@ -16,25 +16,35 @@ MAP_SIZE(<map>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<map>` | 输入的 map 内容 |
-
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 类型,输入的
map 内容。
## 返回值
-
返回 Map 中元素的个数
-## 举例
+## 使用说明
+1. 无论 key 或者 value 是 NULL 都会被计数。
+2. 对于 NULL 参数,返回 NULL。
-```sql
-select map_size(map()),map_size(map(1, "100", 0.1, 2));
-```
-
-```text
-+-----------------+-------------------------------------------------------------------------------------------------+
-| map_size(map()) | map_size(map(cast(1 as DECIMALV3(2, 1)), '100', cast(0.1
as DECIMALV3(2, 1)), cast(2 as TEXT))) |
-+-----------------+-------------------------------------------------------------------------------------------------+
-| 0 |
2 |
-+-----------------+-------------------------------------------------------------------------------------------------+
-```
+## 举例
+1. 常规参数
+ ```sql
+ select map_size(map()), map_size(map(1, "100", 0.1, 2, null, null));
+ ```
+
+ ```text
+ +-----------------+---------------------------------------------+
+ | map_size(map()) | map_size(map(1, "100", 0.1, 2, null, null)) |
+ +-----------------+---------------------------------------------+
+ | 0 | 3 |
+ +-----------------+---------------------------------------------+
+ ```
+2. NULL 参数
+ ```sql
+ select map_size(NULL);
+ ```
+ ```text
+ +----------------+
+ | map_size(NULL) |
+ +----------------+
+ | NULL |
+ +----------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
index d8dfec62890..5df9542bdea 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map-values.md
@@ -7,7 +7,7 @@
## 描述
-将给定 `map` 的值提取成一个对应类型的 `ARRAY`
+将给定 [`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md)
的值提取成一个对应类型的
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md)。
## 语法
@@ -16,25 +16,37 @@ MAP_VALUES(<map>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<map>` | 输入的 map 内容 |
+- `<map>`
[`MAP`](../../../basic-element/sql-data-types/semi-structured/MAP.md) 类型,输入的
map 内容。
## 返回值
+将给定 `map` 的值提取成一个对应类型的
[`ARRAY`](../../../basic-element/sql-data-types/semi-structured/ARRAY.md)。
-将给定 `map` 的值提取成一个对应类型的 `ARRAY`
+## 使用说明
+1. 对于 NULL 参数,返回 NULL。
+2. 对于空的 MAP 对象,返回空的数组。
+3. MAP 中的 NULL 值也会包含在返回的数组中。
## 举例
-
-```sql
-select map_values(map()),map_values(map(1, "100", 0.1, 2));
-```
-
-```text
-+-------------------+---------------------------------------------------------------------------------------------------+
-| map_values(map()) | map_values(map(cast(1 as DECIMALV3(2, 1)), '100',
cast(0.1 as DECIMALV3(2, 1)), cast(2 as TEXT))) |
-+-------------------+---------------------------------------------------------------------------------------------------+
-| [] | ["100", "2"]
|
-+-------------------+---------------------------------------------------------------------------------------------------+
-```
+1. 常规参数
+ ```sql
+ select map_values(map()), map_values(map(1, "100", 0.1, 2, 0.3, null));
+ ```
+
+ ```text
+ +-------------------+----------------------------------------------+
+ | map_values(map()) | map_values(map(1, "100", 0.1, 2, 0.3, null)) |
+ +-------------------+----------------------------------------------+
+ | [] | ["100", "2", null] |
+ +-------------------+----------------------------------------------+
+ ```
+2. NULL 参数
+ ```sql
+ select map_values(null);
+ ```
+ ```text
+ +------------------+
+ | map_values(null) |
+ +------------------+
+ | NULL |
+ +------------------+
+ ```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map.md
index 78a2fd2d2c4..d5c74a2d74e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/map.md
@@ -7,48 +7,74 @@
## 描述
-使用若干组键值对构造一个特定类型的 [`Map<K,
V>`](../../../basic-element/sql-data-types/semi-structured/MAP.md)
+使用若干组键值对构造一个特定类型的 [`MAP<K,
V>`](../../../basic-element/sql-data-types/semi-structured/MAP.md)
## 语法
```sql
-MAP( <key1> , <value1> [, <key2>,<value2> ... ])
+MAP( <key1> , <value1> [, <key2>, <value2> ... ])
```
## 参数
+### 可选参数
+- `<key1>` 支持多种类型(参考 [`MAP<K,
V>`](../../../basic-element/sql-data-types/semi-structured/MAP.md)) 构造 map 的 key
+- `<value1>` 构造 map 的 value
-| 参数 | 说明 |
-| -- | -- |
-| `<key>` | 构造 map 的 key,大小写敏感 |
-| `<value>` | 构造 map 的 value |
+### 可变参数
+支持多组 key-value 参数
## 返回值
-返回由若干组键值对构造的特定类型 `Map<K, V>`
+返回由若干组键值对构造的特定类型 `MAP<K, V>`
-## 举例
+## 注意事项
+1. 参数个数必须为偶数个(可以为 0),否则会报错。
+2. key 参数可以出现重复,但是 Doris 会去掉重复的 key。
+3. key 可以为 NULL,多个 NULL key 会被去重。
-```sql
-select map(1, "100", 0.1, 2),map(1, "100", 0.1, 2)[1];
-```
-
-```text
-+-----------------------+--------------------------+
-| map(1, "100", 0.1, 2) | map(1, "100", 0.1, 2)[1] |
-+-----------------------+--------------------------+
-| {1.0:"100", 0.1:"2"} | 100 |
-+-----------------------+--------------------------+
-```
+## 举例
+1. 普通参数
+ ```sql
+ select map(1, "100", 0.1, 2),map(1, "100", 0.1, 2)[1];
+ ```
-* 如果有重复的 key,会去重:
-```sql
-select map(1, 2, 2, 11, 1, 3);
-```
-```text
-+------------------------+
-| map(1, 2, 2, 11, 1, 3) |
-+------------------------+
-| {2:11, 1:3} |
-+------------------------+
-```
-> 上面有两组参数都是以 1 为 key(1, 2 和 1, 3),最后保留 1, 3。
\ No newline at end of file
+ ```text
+ +-----------------------+--------------------------+
+ | map(1, "100", 0.1, 2) | map(1, "100", 0.1, 2)[1] |
+ +-----------------------+--------------------------+
+ | {1.0:"100", 0.1:"2"} | 100 |
+ +-----------------------+--------------------------+
+ ```
+2. 没有参数的情况
+ ```sql
+ select map();
+ ```
+ ```text
+ +-------+
+ | map() |
+ +-------+
+ | {} |
+ +-------+
+ ```
+3. NULL 参数
+ ```sql
+ select map(null, 2, 3, null);
+ ```
+ ```text
+ +-----------------------+
+ | map(null, 2, 3, null) |
+ +-----------------------+
+ | {null:2, 3:null} |
+ +-----------------------+
+ ```
+4. 如果有重复的 key,会去重
+ ```sql
+ select map(1, 2, 2, 11, 1, 3, null, "null 1", null, "null 2");
+ ```
+ ```text
+ +--------------------------------------------------------+
+ | map(1, 2, 2, 11, 1, 3, null, "null 1", null, "null 2") |
+ +--------------------------------------------------------+
+ | {2:"11", 1:"3", null:"null 2"} |
+ +--------------------------------------------------------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
index 9252e696c35..baea6582967 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/map-functions/str-to-map.md
@@ -21,11 +21,9 @@ STR_TO_MAP(<str> [, <pair_delimiter> [,
<key_value_delimiter>]])
## 参数
-| 参数 | 说明 |
-| -- | -- |
-| `<str>` | 要转换为 map 的字符串 |
-| `<pair_delimiter>` | 字符串中键值对的分割符,默认为 `,` |
-| `<key_value_delimiter>` | 字符串中键和值的分割符,默认为 `:` |
+- `<str>` 要转换为 map 的字符串。
+- `<pair_delimiter>` 字符串中键值对的分割符,默认为 `,`。
+- `<key_value_delimiter>` 字符串中键和值的分割符,默认为 `:`。
## 返回值
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]