This is an automated email from the ASF dual-hosted git repository.
csun5285 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 9b553795db0 [docs] Document nested MAP duplicate key handling (#4308)
9b553795db0 is described below
commit 9b553795db04a78d15cff049f7fb3a2cfb079cf9
Author: Chenyang Sun <[email protected]>
AuthorDate: Thu Oct 15 11:49:46 2026 +0800
[docs] Document nested MAP duplicate key handling (#4308)
## Purpose
Document the nested MAP duplicate-key behavior fixed by Apache Doris PR
#68639.
## Changes
- Document that string casts to MAP, ARRAY, and STRUCT remove duplicate
keys from nested MAPs.
- Clarify that the last value is retained.
- Add examples for MAPs nested in MAP values, ARRAYs, and STRUCTs.
- Keep the English and Chinese current/4.x documentation mirrors in
sync.
## Validation
- `yarn docs:links:changed`
- `yarn docs:i18n-sync:changed`
- `git diff --check`
---
.../sql-data-types/conversion/map-conversion.md | 16 ++++++++++++++++
.../sql-data-types/conversion/map-conversion.md | 16 ++++++++++++++++
.../sql-data-types/conversion/map-conversion.md | 16 ++++++++++++++++
.../sql-data-types/conversion/map-conversion.md | 16 ++++++++++++++++
4 files changed, 64 insertions(+)
diff --git
a/docs/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
b/docs/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
index 7499e4a7ef3..09ae1566dc4 100644
--- a/docs/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
+++ b/docs/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
@@ -114,6 +114,22 @@ If key/value in key-value pairs does not meet the format
of the corresponding ty
| '{ "123":"abc" }' | Cast to MAP\<int,int\>: {123:null} | "abc" cannot be
converted to int type, converted to null |
| '{ 1:2 ,34, 5:6}' | NULL | Does not meet MAP format |
+#### Duplicate Keys in Nested MAPs
+
+When a string is cast to a `MAP`, `ARRAY`, or `STRUCT`, Doris removes
duplicate keys from every `MAP` in the converted result, including MAPs nested
in an `ARRAY`, a `STRUCT`, or a MAP value. When a key occurs more than once,
the last value is retained.
+
+```sql
+SELECT CAST('{"outer":[{"a":1,"a":2}]}' AS MAP<STRING, ARRAY<MAP<STRING,
INT>>>);
+SELECT CAST('[{"a":1,"a":2}]' AS ARRAY<MAP<STRING, INT>>);
+SELECT CAST('{"m":{"a":1,"a":2}}' AS STRUCT<m:MAP<STRING, INT>>);
+```
+
+```text
+{"outer":[{"a":2}]}
+[{"a":2}]
+{"m":{"a":2}}
+```
+
### FROM MAP\<Other Type\>
#### Strict Mode
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
index e02d9282968..f87eacf4140 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
@@ -114,6 +114,22 @@ MAP 类型用于存储和处理键值对数据,可以包含各种基本类型
| '{ "123":"abc" }' | Cast to MAP\<int,int\>: {123:null} | "abc" 无法转换成 int
类型,转换为 null |
| '{ 1:2 ,34, 5:6}' | NULL | 不满足 MAP 的格式 |
+#### 嵌套 MAP 中的重复键
+
+将字符串转换为 `MAP`、`ARRAY` 或 `STRUCT` 时,Doris 会删除转换结果中所有 `MAP` 的重复键,包括嵌套在
`ARRAY`、`STRUCT` 或 MAP 值中的 MAP。同一个键出现多次时,保留最后一次出现的值。
+
+```sql
+SELECT CAST('{"outer":[{"a":1,"a":2}]}' AS MAP<STRING, ARRAY<MAP<STRING,
INT>>>);
+SELECT CAST('[{"a":1,"a":2}]' AS ARRAY<MAP<STRING, INT>>);
+SELECT CAST('{"m":{"a":1,"a":2}}' AS STRUCT<m:MAP<STRING, INT>>);
+```
+
+```text
+{"outer":[{"a":2}]}
+[{"a":2}]
+{"m":{"a":2}}
+```
+
### FROM MAP\<Other Type\>
#### 严格模式
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
index e02d9282968..f87eacf4140 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
@@ -114,6 +114,22 @@ MAP 类型用于存储和处理键值对数据,可以包含各种基本类型
| '{ "123":"abc" }' | Cast to MAP\<int,int\>: {123:null} | "abc" 无法转换成 int
类型,转换为 null |
| '{ 1:2 ,34, 5:6}' | NULL | 不满足 MAP 的格式 |
+#### 嵌套 MAP 中的重复键
+
+将字符串转换为 `MAP`、`ARRAY` 或 `STRUCT` 时,Doris 会删除转换结果中所有 `MAP` 的重复键,包括嵌套在
`ARRAY`、`STRUCT` 或 MAP 值中的 MAP。同一个键出现多次时,保留最后一次出现的值。
+
+```sql
+SELECT CAST('{"outer":[{"a":1,"a":2}]}' AS MAP<STRING, ARRAY<MAP<STRING,
INT>>>);
+SELECT CAST('[{"a":1,"a":2}]' AS ARRAY<MAP<STRING, INT>>);
+SELECT CAST('{"m":{"a":1,"a":2}}' AS STRUCT<m:MAP<STRING, INT>>);
+```
+
+```text
+{"outer":[{"a":2}]}
+[{"a":2}]
+{"m":{"a":2}}
+```
+
### FROM MAP\<Other Type\>
#### 严格模式
diff --git
a/versioned_docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
b/versioned_docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
index 7499e4a7ef3..09ae1566dc4 100644
---
a/versioned_docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
+++
b/versioned_docs/version-4.x/sql-manual/basic-element/sql-data-types/conversion/map-conversion.md
@@ -114,6 +114,22 @@ If key/value in key-value pairs does not meet the format
of the corresponding ty
| '{ "123":"abc" }' | Cast to MAP\<int,int\>: {123:null} | "abc" cannot be
converted to int type, converted to null |
| '{ 1:2 ,34, 5:6}' | NULL | Does not meet MAP format |
+#### Duplicate Keys in Nested MAPs
+
+When a string is cast to a `MAP`, `ARRAY`, or `STRUCT`, Doris removes
duplicate keys from every `MAP` in the converted result, including MAPs nested
in an `ARRAY`, a `STRUCT`, or a MAP value. When a key occurs more than once,
the last value is retained.
+
+```sql
+SELECT CAST('{"outer":[{"a":1,"a":2}]}' AS MAP<STRING, ARRAY<MAP<STRING,
INT>>>);
+SELECT CAST('[{"a":1,"a":2}]' AS ARRAY<MAP<STRING, INT>>);
+SELECT CAST('{"m":{"a":1,"a":2}}' AS STRUCT<m:MAP<STRING, INT>>);
+```
+
+```text
+{"outer":[{"a":2}]}
+[{"a":2}]
+{"m":{"a":2}}
+```
+
### FROM MAP\<Other Type\>
#### Strict Mode
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]