This is an automated email from the ASF dual-hosted git repository.
morningman 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 69b0e95ae128 [docs] Make 3.x STRUCT_ELEMENT table example reproducible
(#4618)
69b0e95ae128 is described below
commit 69b0e95ae1285af00cf66e17887f1c79d80ed29f
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Fri Nov 13 08:02:47 2026 +0800
[docs] Make 3.x STRUCT_ELEMENT table example reproducible (#4618)
Define and populate test_struct before querying it, order rows
explicitly, and replace legacy positional STRUCT output with named JSON
fields and nested null values.
Fixes #3894
Versions and languages: 3.x English and Chinese; 2.1 archived snapshots
unchanged; dev/4.x use different examples.
Source verification:
- branch-3.0 and branch-3.1 data_type_struct_serde.cpp write quoted
field names; the MySQL result writer uses a colon with no following
space, comma-space separators, and lowercase nested null in the default
DORIS serde dialect
- branch-3.1 data_type_nullable_serde.cpp renders nested null values as
null
- branch-3.1 function_struct_element.cpp resolves the named field and
returns its child value
Validation:
- Checked each displayed struct and extracted f1 against its
corresponding inserted row
- Confirmed example includes whole-struct NULL and nested NULL fields
- Compared both active 3.x locale copies and reviewed dev/4.x
counterparts
- git diff --check
Review:
- Goal: correct the reported documentation issue; the changed content
directly addresses it.
- Scope: targeted documentation edits.
- Information architecture: active version and locale counterparts
inspected; archived snapshots unchanged.
- Navigation: no paths, slugs, anchors or sidebar entries changed.
- Frontend/build: no framework, styling or build-script changes.
- Validation limits: no live Doris execution or full website build
performed.
- Other concerns: No additional correctness, usability, accessibility,
SEO or maintainability issues found in the changed content.
Co-authored-by: morningman <[email protected]>
---
.../struct-functions/struct-element.md | 36 ++++++++++++++++------
.../struct-functions/struct-element.md | 36 ++++++++++++++++------
2 files changed, 52 insertions(+), 20 deletions(-)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
index 8bb174744fb9..dd6f41b4dd35 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
@@ -43,17 +43,33 @@ select struct_element(named_struct('f1', 1, 'f2', 'a'),
'f2'),struct_element(nam
```
```sql
-select struct_col, struct_element(struct_col, 'f1') from test_struct;
+CREATE TABLE test_struct (
+ id INT,
+ struct_col STRUCT<f1: BIGINT, f2: BIGINT, f3: BIGINT, f4: BIGINT, f5:
BIGINT>
+) DUPLICATE KEY(id)
+DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_struct VALUES
+(1, NAMED_STRUCT('f1', 1, 'f2', 2, 'f3', 3, 'f4', 4, 'f5', 5)),
+(2, NAMED_STRUCT('f1', 1, 'f2', 1000, 'f3', 10000000, 'f4', 100000000000,
'f5', 100000000000)),
+(3, NAMED_STRUCT('f1', 5, 'f2', 4, 'f3', 3, 'f4', 2, 'f5', 1)),
+(4, NULL),
+(5, NAMED_STRUCT('f1', 1, 'f2', NULL, 'f3', 3, 'f4', NULL, 'f5', 5));
+
+SELECT struct_col, STRUCT_ELEMENT(struct_col, 'f1') AS f1
+FROM test_struct
+ORDER BY id;
```
```text
-+-------------------------------------------------+-------------------------------------+
-| struct_col | struct_element(`struct_col
`, 'f1') |
-+-------------------------------------------------+-------------------------------------+
-| {1, 2, 3, 4, 5} |
1 |
-| {1, 1000, 10000000, 100000000000, 100000000000} |
1 |
-| {5, 4, 3, 2, 1} |
5 |
-| NULL |
NULL |
-| {1, NULL, 3, NULL, 5} |
1 |
-+-------------------------------------------------+-------------------------------------+
++--------------------------------------------------------------------------+------+
+| struct_col |
f1 |
++--------------------------------------------------------------------------+------+
+| {"f1":1, "f2":2, "f3":3, "f4":4, "f5":5} | 1
|
+| {"f1":1, "f2":1000, "f3":10000000, "f4":100000000000, "f5":100000000000} | 1
|
+| {"f1":5, "f2":4, "f3":3, "f4":2, "f5":1} | 5
|
+| NULL |
NULL |
+| {"f1":1, "f2":null, "f3":3, "f4":null, "f5":5} | 1
|
++--------------------------------------------------------------------------+------+
```
diff --git
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
index 90314847d46f..6010c323b883 100644
---
a/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
+++
b/versioned_docs/version-3.x/sql-manual/sql-functions/scalar-functions/struct-functions/struct-element.md
@@ -43,17 +43,33 @@ select struct_element(named_struct('f1', 1, 'f2', 'a'),
'f2'),struct_element(nam
```
```sql
-select struct_col, struct_element(struct_col, 'f1') from test_struct;
+CREATE TABLE test_struct (
+ id INT,
+ struct_col STRUCT<f1: BIGINT, f2: BIGINT, f3: BIGINT, f4: BIGINT, f5:
BIGINT>
+) DUPLICATE KEY(id)
+DISTRIBUTED BY HASH(id) BUCKETS 1
+PROPERTIES ("replication_num" = "1");
+
+INSERT INTO test_struct VALUES
+(1, NAMED_STRUCT('f1', 1, 'f2', 2, 'f3', 3, 'f4', 4, 'f5', 5)),
+(2, NAMED_STRUCT('f1', 1, 'f2', 1000, 'f3', 10000000, 'f4', 100000000000,
'f5', 100000000000)),
+(3, NAMED_STRUCT('f1', 5, 'f2', 4, 'f3', 3, 'f4', 2, 'f5', 1)),
+(4, NULL),
+(5, NAMED_STRUCT('f1', 1, 'f2', NULL, 'f3', 3, 'f4', NULL, 'f5', 5));
+
+SELECT struct_col, STRUCT_ELEMENT(struct_col, 'f1') AS f1
+FROM test_struct
+ORDER BY id;
```
```text
-+-------------------------------------------------+-------------------------------------+
-| struct_col | struct_element(`struct_col
`, 'f1') |
-+-------------------------------------------------+-------------------------------------+
-| {1, 2, 3, 4, 5} |
1 |
-| {1, 1000, 10000000, 100000000000, 100000000000} |
1 |
-| {5, 4, 3, 2, 1} |
5 |
-| NULL |
NULL |
-| {1, NULL, 3, NULL, 5} |
1 |
-+-------------------------------------------------+-------------------------------------+
++--------------------------------------------------------------------------+------+
+| struct_col |
f1 |
++--------------------------------------------------------------------------+------+
+| {"f1":1, "f2":2, "f3":3, "f4":4, "f5":5} | 1
|
+| {"f1":1, "f2":1000, "f3":10000000, "f4":100000000000, "f5":100000000000} | 1
|
+| {"f1":5, "f2":4, "f3":3, "f4":2, "f5":1} | 5
|
+| NULL |
NULL |
+| {"f1":1, "f2":null, "f3":3, "f4":null, "f5":5} | 1
|
++--------------------------------------------------------------------------+------+
```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]