This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 fcfe2af571b update explode_json_array series functions doc (#2748)
fcfe2af571b is described below
commit fcfe2af571bf136873843efa0bb1d77b40fc6262
Author: Jerry Hu <[email protected]>
AuthorDate: Fri Aug 15 16:29:41 2025 +0800
update explode_json_array series functions doc (#2748)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../explode-json-array-double-outer.md | 100 ++++++++++++++
.../table-functions/explode-json-array-double.md | 146 ++++++++++----------
.../explode-json-array-int-outer.md | 101 ++++++++++++++
.../table-functions/explode-json-array-int.md | 149 ++++++++++----------
.../explode-json-array-json-outer.md | 82 +++++++++++
.../table-functions/explode-json-array-json.md | 97 ++++++-------
.../explode-json-array-string-outer.md | 83 +++++++++++
.../table-functions/explode-json-array-string.md | 129 +++++++----------
.../explode-json-array-double-outer.md | 100 ++++++++++++++
.../table-functions/explode-json-array-double.md | 149 ++++++++++----------
.../explode-json-array-int-outer.md | 82 +++++++++++
.../table-functions/explode-json-array-int.md | 152 ++++++++++-----------
.../explode-json-array-json-outer.md | 82 +++++++++++
.../table-functions/explode-json-array-json.md | 98 ++++++-------
.../explode-json-array-string-outer.md | 83 +++++++++++
.../table-functions/explode-json-array-string.md | 132 ++++++++----------
sidebars.json | 6 +-
17 files changed, 1209 insertions(+), 562 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-double-outer.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-double-outer.md
new file mode 100644
index 00000000000..d52cd3690ba
--- /dev/null
+++
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-double-outer.md
@@ -0,0 +1,100 @@
+
+---
+{
+"title": "EXPLODE_JSON_ARRAY_DOUBLE_OUTER",
+"language": "en"
+}
+---
+
+## Description
+The `explode_json_array_double_outer` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode_outer` function for processing. The behavior is equivalent
to: `explode_outer(cast(<json_array> as Array<DOUBLE>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+```sql
+EXPLODE_JSON_ARRAY_DOUBLE_OUTER(<json>)
+```
+
+## Parameters
+- `<json>` JSON type, the content should be an array.
+
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<DOUBLE>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 1 row with
NULL is returned.
+- If the elements in the JSON array are not of DOUBLE type, the function will
try to convert them to DOUBLE. Elements that cannot be converted to DOUBLE will
be converted to NULL. For type conversion rules, please refer to [JSON Type
Conversion](../../basic-element/sql-data-types/conversion/json-conversion.md).
+
+## Examples
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_double_outer('[4, 5,
5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. DOUBLE type
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_double_outer('[123.445, 9223372036854775807.0,
9223372036854775808.0, -9223372036854775808.0, -9223372036854775809.0]') t2 as
c;
+ ```
+ ```text
+ +------+------------------------+
+ | k1 | c |
+ +------+------------------------+
+ | 1 | 123.445 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ +------+------------------------+
+ ```
+3. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_double_outer('[]')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_double_outer(NULL)
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+5. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_double_outer('{}')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-double.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-double.md
index cf7dfed92ad..4bdca348aea 100644
--- a/docs/sql-manual/sql-functions/table-functions/explode-json-array-double.md
+++ b/docs/sql-manual/sql-functions/table-functions/explode-json-array-double.md
@@ -6,90 +6,82 @@
---
## Description
-
-The `explode_json_array_double` table function accepts a JSON array, where
each element is of double-precision floating-point type, and expands each
floating-point number in the array into multiple rows, with each row containing
one floating-point number. It is used in conjunction with LATERAL VIEW.
-
-`explode_json_array_double_outer` is similar to `explode_json_array_double`,
but the handling of NULL values is different.
-
-If the JSON string itself is NULL, the `OUTER` version will return one row,
with the value as NULL. The normal version will completely ignore such records.
-
-If the JSON array is empty, the `OUTER` version will return one row, with the
value as NULL. The normal version will return no results.
+The `explode_json_array_double` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode` function for processing. The behavior is equivalent to:
`explode(cast(<json_array> as Array<DOUBLE>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
## Syntax
```sql
EXPLODE_JSON_ARRAY_DOUBLE(<json>)
-EXPLODE_JSON_ARRAY_DOUBLE_OUTER(<json>)
```
-## Return Value
-
-| Parameter | Description |
-| -- | -- |
-| `<json>` | json type |
-
## Parameters
+- `<json>` JSON type, the content should be an array.
-Expands the JSON array, creating a row for each element, returning a
double-precision floating-point column.
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<DOUBLE>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 0 rows are
returned.
+- If the elements in the JSON array are not of DOUBLE type, the function will
try to convert them to DOUBLE. Elements that cannot be converted to DOUBLE will
be converted to NULL. For type conversion rules, please refer to [JSON Type
Conversion](../../basic-element/sql-data-types/conversion/json-conversion.md).
## Examples
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE(json_array) tmp1 AS e1
-WHERE id = 2;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 2 | 1.1 |
-| 2 | 2.2 |
-| 2 | 3.3 |
-| 2 | 4.4 |
-+------+------+
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE(json_array) tmp1 AS e1
-WHERE id = 6;
-Empty set (0.01 sec)
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE_OUTER(json_array) tmp1 AS e1
-WHERE id = 6;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 6 | NULL |
-+------+------+
-```
\ No newline at end of file
+0. Prepare data
+ ```sql
+ create table example(
+ id int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_double('[4, 5, 5.23,
null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | id | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. DOUBLE type
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_double('[123.445, 9223372036854775807.0,
9223372036854775808.0, -9223372036854775808.0, -9223372036854775809.0]') t2 as
c;
+ ```
+ ```text
+ +------+------------------------+
+ | id | c |
+ +------+------------------------+
+ | 1 | 123.445 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ +------+------------------------+
+ ```
+3. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_double('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_double(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+5. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_double('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-int-outer.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-int-outer.md
new file mode 100644
index 00000000000..063b1cc2431
--- /dev/null
+++
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-int-outer.md
@@ -0,0 +1,101 @@
+---
+{
+"title": "EXPLODE_JSON_ARRAY_INT_OUTER",
+"language": "en"
+}
+---
+
+## Description
+The `explode_json_array_int_outer` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode` function for processing. The behavior is equivalent to:
`explode_outer(cast(<json_array> as Array<BIGINT>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+```sql
+EXPLODE_JSON_ARRAY_INT_OUTER(<json>)
+```
+
+## Parameters
+- `<json>` JSON type, the content should be an array.
+
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<BIGINT>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), return one
row containing NULL.
+- If the elements in the JSON array are not of INT type, the function will try
to convert them to INT. Elements that cannot be converted to INT will be
converted to NULL. For type conversion rules, please refer to [JSON Type
Conversion](../../basic-element/sql-data-types/conversion/json-conversion.md).
+
+## Examples
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_int_outer('[4, 5,
5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. Non-INT type
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_int_outer('["abc", "123.4", 9223372036854775808.0,
9223372036854775295.999999]') t2 as c;
+ ```
+ ```text
+ +------+---------------------+
+ | k1 | c |
+ +------+---------------------+
+ | 1 | NULL |
+ | 1 | 123 |
+ | 1 | NULL |
+ | 1 | 9223372036854774784 |
+ +------+---------------------+
+ ```
+ > `9223372036854775808.0` exceeds the valid range of `BIGINT`, so it will
be converted to NULL.
+ > The string "123.4" is converted to 123.
+ > The string "abc" cannot be converted to INT, so the result is NULL.
+3. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_int_outer('[]') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_int_outer(NULL) t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+5. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_int_outer('{}') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-int.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-int.md
index ffba29093ad..f7fd7b7d6e7 100644
--- a/docs/sql-manual/sql-functions/table-functions/explode-json-array-int.md
+++ b/docs/sql-manual/sql-functions/table-functions/explode-json-array-int.md
@@ -6,91 +6,84 @@
---
## Description
-
-The `explode_json_array_int` table function accepts a JSON array, where each
element is of integer type, and expands each integer in the array into multiple
rows, with each row containing one integer. It is used in conjunction with
LATERAL VIEW.
-
-`explode_json_array_int_outer` is similar to `explode_json_array_int`, but the
handling of NULL values is different.
-
-If the JSON string itself is NULL, the `OUTER` version will return one row,
with the value as NULL. The normal version will completely ignore such records.
-
-If the JSON array is empty, the `OUTER` version will return one row, with the
value as NULL. The normal version will return no results.
+The `explode_json_array_int` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode` function for processing. The behavior is equivalent to:
`explode(cast(<json_array> as Array<BIGINT>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
## Syntax
```sql
EXPLODE_JSON_ARRAY_INT(<json>)
-EXPLODE_JSON_ARRAY_INT_OUTER(<json>)
```
-## Return Value
-
-| Parameter | Description |
-| -- | -- |
-| `<json>` | json type |
-
## Parameters
+- `<json>` JSON type, the content should be an array.
-Expands the JSON array, creating a row for each element, returning an integer
column.
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<BIGINT>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 0 rows are
returned.
+- If the elements in the JSON array are not of INT type, the function will try
to convert them to INT. Elements that cannot be converted to INT will be
converted to NULL. For type conversion rules, please refer to [JSON Type
Conversion](../../basic-element/sql-data-types/conversion/json-conversion.md).
## Examples
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_INT(json_array) tmp1 AS e1
-WHERE id = 1;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 1 | 1 |
-| 1 | 2 |
-| 1 | 3 |
-| 1 | 4 |
-| 1 | 5 |
-+------+------+
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_INT(json_array) tmp1 AS e1
-WHERE id = 5;
-Empty set (0.01 sec)
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_INT_OUTER(json_array) tmp1 AS e1
-WHERE id = 5;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 5 | NULL |
-+------+------+
-```
\ No newline at end of file
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_int('[4, 5, 5.23,
null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. Non-INT type
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_int('["abc", "123.4", 9223372036854775808.0,
9223372036854775295.999999]') t2 as c;
+ ```
+ ```text
+ +------+---------------------+
+ | k1 | c |
+ +------+---------------------+
+ | 1 | NULL |
+ | 1 | 123 |
+ | 1 | NULL |
+ | 1 | 9223372036854774784 |
+ +------+---------------------+
+ ```
+ > `9223372036854775808.0` exceeds the valid range of `BIGINT`, so it will
be converted to NULL.
+ > The string "123.4" is converted to 123.
+ > The string "abc" cannot be converted to INT, so the result is NULL.
+3. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_int('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_int(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+5. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_int('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-json-outer.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-json-outer.md
new file mode 100644
index 00000000000..d846b4b7824
--- /dev/null
+++
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-json-outer.md
@@ -0,0 +1,82 @@
+---
+{
+"title": "EXPLODE_JSON_ARRAY_JSON_OUTER",
+"language": "en"
+}
+---
+
+## Description
+The `explode_json_array_json_outer` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode_outer` function for processing. The behavior is equivalent
to: `explode_outer(cast(<json_array> as Array<JSON>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+```sql
+EXPLODE_JSON_ARRAY_JSON_OUTER(<json>)
+```
+
+## Parameters
+- `<json>` JSON type, the content should be an array.
+
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<JSON>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 1 row with
NULL is returned.
+
+## Examples
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('[4,
"abc", {"key": "value"}, 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+-----------------+
+ | k1 | c |
+ +------+-----------------+
+ | 1 | 4 |
+ | 1 | "abc" |
+ | 1 | {"key":"value"} |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+-----------------+
+ ```
+2. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('[]') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+3. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_json_outer(NULL) t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('{}') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-json.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-json.md
index f12d69a9edd..974dc36faf7 100644
--- a/docs/sql-manual/sql-functions/table-functions/explode-json-array-json.md
+++ b/docs/sql-manual/sql-functions/table-functions/explode-json-array-json.md
@@ -6,60 +6,65 @@
---
## Description
-
-The `explode_json_array_json` table function accepts a JSON array, where each
element is of JSON object type, and expands each JSON object in the array into
multiple rows, with each row containing one JSON object. It is used in
conjunction with LATERAL VIEW.
+The `explode_json_array_json` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode` function for processing. The behavior is equivalent to:
`explode(cast(<json_array> as Array<JSON>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
## Syntax
```sql
EXPLODE_JSON_ARRAY_JSON(<json>)
-EXPLODE_JSON_ARRAY_JSON_OUTER(<json>)
```
-## Return Value
-
-| Parameter | Description |
-| -- | -- |
-| `<json>` | json type |
-
## Parameters
+- `<json>` JSON type, the content should be an array.
-Expands the JSON array, creating a row for each element, returning a JSON
object column.
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<JSON>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 0 rows are
returned.
## Examples
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_JSON(json_array) tmp1 AS e1
-WHERE id = 4;
-```
-
-```text
-+------+---------+
-| id | e1 |
-+------+---------+
-| 4 | {"a":1} |
-| 4 | {"b":2} |
-| 4 | {"c":3} |
-+------+---------+
-```
\ No newline at end of file
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_json('[4, "abc",
{"key": "value"}, 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+-----------------+
+ | k1 | c |
+ +------+-----------------+
+ | 1 | 4 |
+ | 1 | NULL |
+ | 1 | {"key":"value"} |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+-----------------+
+ ```
+2. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_json('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+3. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_json(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_json('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-string-outer.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-string-outer.md
new file mode 100644
index 00000000000..7dafa34d0dc
--- /dev/null
+++
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-string-outer.md
@@ -0,0 +1,83 @@
+---
+{
+"title": "EXPLODE_JSON_ARRAY_STRING_OUTER",
+"language": "en"
+}
+---
+
+## Description
+The `explode_json_array_string_outer` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode_outer` function for processing. The behavior is equivalent
to: `explode_outer(cast(<json_array> as Array<STRING>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+```sql
+EXPLODE_JSON_ARRAY_STRING_OUTER(<json>)
+```
+
+## Parameters
+- `<json>` JSON type, the content should be an array.
+
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<STRING>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 1 row with
NULL is returned.
+- If the elements in the JSON array are not of STRING type, the function will
try to convert them to STRING. If conversion to STRING fails, the element will
be converted to NULL. For type conversion rules, please refer to [JSON Type
Conversion](../../basic-element/sql-data-types/conversion/json-conversion.md).
+
+## Examples
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_string_outer('[4,
"5", "abc", 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | abc |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_string_outer('[]')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+3. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_string_outer(NULL)
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_string_outer('{}')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-json-array-string.md
b/docs/sql-manual/sql-functions/table-functions/explode-json-array-string.md
index ba863600869..4a751f2775b 100644
--- a/docs/sql-manual/sql-functions/table-functions/explode-json-array-string.md
+++ b/docs/sql-manual/sql-functions/table-functions/explode-json-array-string.md
@@ -6,89 +6,66 @@
---
## Description
-
-The `explode_json_array_string` table function accepts a JSON array, where
each element is of string type, and expands each string in the array into
multiple rows, with each row containing one string. It is used in conjunction
with LATERAL VIEW.
-
-`explode_json_array_string_outer` is similar to `explode_json_array_string`,
but the handling of NULL values is different.
-
-If the JSON string itself is NULL, the `OUTER` version will return one row,
with the value as NULL. The normal version will completely ignore such records.
-
-If the JSON array is empty, the `OUTER` version will return one row, with the
value as NULL. The normal version will return no results.
+The `explode_json_array_string` table function accepts a JSON array. Its
implementation logic is to convert the JSON array to an array type and then
call the `explode` function for processing. The behavior is equivalent to:
`explode(cast(<json_array> as Array<STRING>))`.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md).
## Syntax
```sql
EXPLODE_JSON_ARRAY_STRING(<json>)
-EXPLODE_JSON_ARRAY_STRING_OUTER(<json>)
```
-## Return Value
-
-| Parameter | Description |
-| -- | -- |
-| `<json>` | json type |
-
## Parameters
+- `<json>` JSON type, the content should be an array.
-Expands the JSON array, creating a row for each element, returning a string
column.
+## Return Value
+- Returns a single-column, multi-row result composed of all elements in
`<json>`. The column type is `Nullable<STRING>`.
+- If `<json>` is NULL or an empty array (number of elements is 0), 0 rows are
returned.
+- If the elements in the JSON array are not of STRING type, the function will
try to convert them to STRING. If conversion to STRING fails, the element will
be converted to NULL. For type conversion rules, please refer to [JSON Type
Conversion](../../basic-element/sql-data-types/conversion/json-conversion.md).
## Examples
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_STRING(json_array) tmp1 AS e1
-WHERE id = 3;
-```
-
-```text
-+------+--------+
-| id | e1 |
-+------+--------+
-| 3 | apple |
-| 3 | banana |
-| 3 | cherry |
-+------+--------+
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_STRING(json_array) tmp1 AS e1
-WHERE id = 6;
-Empty set (0.02 sec)
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_STRING_OUTER(json_array) tmp1 AS e1
-WHERE id = 6;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 6 | NULL |
-+------+------+
-```
\ No newline at end of file
+0. Prepare data
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. Regular parameters
+ ```sql
+ select * from example lateral view explode_json_array_string('[4, "5",
"abc", 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | abc |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. Empty array
+ ```sql
+ select * from example lateral view explode_json_array_string('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+3. NULL parameter
+ ```sql
+ select * from example lateral view explode_json_array_string(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. Non-array parameter
+ ```sql
+ select * from example lateral view explode_json_array_string('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double-outer.md
new file mode 100644
index 00000000000..469c69dcf45
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double-outer.md
@@ -0,0 +1,100 @@
+
+---
+{
+"title": "EXPLODE_JSON_ARRAY_DOUBLE_OUTER",
+"language": "zh-CN"
+}
+---
+
+## 描述
+`explode_json_array_double_outer` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode_outer` 函数处理,行为等价于:`explode_outer(cast(<json_array> as Array<DOUBLE>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+## 语法
+```sql
+EXPLODE_JSON_ARRAY_DOUBLE_OUTER(<json>)
+```
+
+## 参数
+- `<json>` JSON 类型,其内容应该是数组。
+
+## 返回值
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<DOUBLE>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 1 行 NULL 数据。
+- 如果 JSON 数组的元素不是 DOUBLE 类型,会尝试将其转换为 DOUBLE 类型,无法转换为 DOUBLE 类型的被转换为
NULL,类型转换规则参考:[JSON
类型转换](../../basic-element/sql-data-types/conversion/json-conversion.md)
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_double_outer('[4, 5,
5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. double 类型
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_double_outer('[123.445, 9223372036854775807.0,
9223372036854775808.0, -9223372036854775808.0, -9223372036854775809.0]') t2 as
c;
+ ```
+ ```text
+ +------+------------------------+
+ | k1 | c |
+ +------+------------------------+
+ | 1 | 123.445 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ +------+------------------------+
+ ```
+3. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_double_outer('[]')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_double_outer(NULL)
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+5. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_double_outer('{}')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double.md
index bb9dd0db86f..54ae9b5f83b 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-double.md
@@ -6,91 +6,82 @@
---
## 描述
-
-`explode_json_array_double` 表函数,接受一个 JSON 数组,其中每个元素是双精度浮点数类型,将该 JSON
数组中的每个浮点数展开为多行,每行包含一个浮点数。配合 LATERAL VIEW 使用。
-
-`explode_json_array_double_outer` 和 `explode_json_array_double` 类似,对于空值或 NULL
的处理不同。
-
-如果 JSON 字符串本身为 NULL,`OUTER` 版本会返回一行,且该行中的值为 NULL。普通版本会完全忽略这类记录。
-
-如果 JSON 数组为空,`OUTER` 版本会返回一行,且该行的值为 NULL。普通版本则不会返回任何结果。
+`explode_json_array_double` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode` 函数处理,行为等价于:`explode(cast(<json_array> as Array<DOUBLE>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
## 语法
-
```sql
EXPLODE_JSON_ARRAY_DOUBLE(<json>)
-EXPLODE_JSON_ARRAY_DOUBLE_OUTER(<json>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<json>` | json 类型 |
+- `<json>` JSON 类型,其内容应该是数组。
## 返回值
-
-展开 JSON 数组,每个元素生成一行,返回双精度浮点数列。
-
-## 举例
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE(json_array) tmp1 AS e1
-WHERE id = 2;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 2 | 1.1 |
-| 2 | 2.2 |
-| 2 | 3.3 |
-| 2 | 4.4 |
-+------+------+
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE(json_array) tmp1 AS e1
-WHERE id = 6;
-Empty set (0.01 sec)
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE_OUTER(json_array) tmp1 AS e1
-WHERE id = 6;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 6 | NULL |
-+------+------+
-```
\ No newline at end of file
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<DOUBLE>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 0 行数据。
+- 如果 JSON 数组的元素不是 DOUBLE 类型,会尝试将其转换为 DOUBLE 类型,无法转换为 DOUBLE 类型的被转换为
NULL,类型转换规则参考:[JSON
类型转换](../../basic-element/sql-data-types/conversion/json-conversion.md)。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ id int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_double('[4, 5, 5.23,
null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | id | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. double 类型
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_double('[123.445, 9223372036854775807.0,
9223372036854775808.0, -9223372036854775808.0, -9223372036854775809.0]') t2 as
c;
+ ```
+ ```text
+ +------+------------------------+
+ | id | c |
+ +------+------------------------+
+ | 1 | 123.445 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | 9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ | 1 | -9.223372036854776e+18 |
+ +------+------------------------+
+ ```
+3. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_double('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_double(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+5. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_double('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int-outer.md
new file mode 100644
index 00000000000..232c5643e0c
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int-outer.md
@@ -0,0 +1,82 @@
+---
+{
+"title": "EXPLODE_JSON_ARRAY_JSON_OUTER",
+"language": "zh-CN"
+}
+---
+
+## 描述
+`explode_json_array_json_outer` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode_outer` 函数处理,行为等价于:`explode_outer(cast(<json_array> as Array<JSON>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+## 语法
+```sql
+EXPLODE_JSON_ARRAY_JSON_OUTER(<json>)
+```
+
+## 参数
+- `<json>` JSON 类型,其内容应该是数组。
+
+## 返回值
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<JSON>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 1 行 NULL 数据。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('[4,
"abc", {"key": "value"}, 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+-----------------+
+ | k1 | c |
+ +------+-----------------+
+ | 1 | 4 |
+ | 1 | "abc" |
+ | 1 | {"key":"value"} |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+-----------------+
+ ```
+2. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('[]') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+3. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_json_outer(NULL) t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('{}') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int.md
index abfe65c3b95..cbf080d1561 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-int.md
@@ -6,92 +6,84 @@
---
## 描述
-
-`explode_json_array_int` 表函数,接受一个 JSON 数组,其中每个元素是整数类型,将该 JSON
数组中的每个整数展开为多行,每行包含一个整数。配合 LATERAL VIEW 使用。
-
-`explode_json_array_int_outer` 和 `explode_json_array_int` 类似,对于空值或 NULL 的处理不同。
-
-如果 JSON 字符串本身为 NULL,`OUTER` 版本会返回一行,且该行中的值为 NULL。普通版本会完全忽略这类记录。
-
-如果 JSON 数组为空,`OUTER` 版本会返回一行,且该行的值为 NULL。普通版本则不会返回任何结果。
+`explode_json_array_int` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode` 函数处理,行为等价于:`explode(cast(<json_array> as Array<BIGINT>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
## 语法
-
```sql
EXPLODE_JSON_ARRAY_INT(<json>)
-EXPLODE_JSON_ARRAY_INT_OUTER(<json>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<json>` | json 类型 |
+- `<json>` JSON 类型,其内容应该是数组。
## 返回值
-
-展开 JSON 数组,每个元素生成一行,返回整数列。
-
-## 举例
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_INT(json_array) tmp1 AS e1
-WHERE id = 1;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 1 | 1 |
-| 1 | 2 |
-| 1 | 3 |
-| 1 | 4 |
-| 1 | 5 |
-+------+------+
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_INT(json_array) tmp1 AS e1
-WHERE id = 5;
-Empty set (0.01 sec)
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_INT_OUTER(json_array) tmp1 AS e1
-WHERE id = 5;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 5 | NULL |
-+------+------+
-```
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<BIGINT>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 0 行数据。
+- 如果 JSON 数组的元素不是 INT 类型,会尝试将其转换为 INT,无法转换为 INT 类型的被转换为 NULL,关于类型转换的规则请参考
[JSON 类型转换](../../basic-element/sql-data-types/conversion/json-conversion.md)。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_int('[4, 5, 5.23,
null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | 5 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. 非 INT 类型
+ ```sql
+ select * from example
+ lateral view
+ explode_json_array_int('["abc", "123.4", 9223372036854775808.0,
9223372036854775295.999999]') t2 as c;
+ ```
+ ```text
+ +------+---------------------+
+ | k1 | c |
+ +------+---------------------+
+ | 1 | NULL |
+ | 1 | 123 |
+ | 1 | NULL |
+ | 1 | 9223372036854774784 |
+ +------+---------------------+
+ ```
+ > `9223372036854775808.0` 超过 `BIGINT` 的有效范围,所以会被转换为 NULL。
+ > 字符串 "123.4" 被转换为 123。
+ > 字符串 "abc" 无法转换为 INT,所以得到的是 NULL。
+3. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_int('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_int(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+5. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_int('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json-outer.md
new file mode 100644
index 00000000000..232c5643e0c
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json-outer.md
@@ -0,0 +1,82 @@
+---
+{
+"title": "EXPLODE_JSON_ARRAY_JSON_OUTER",
+"language": "zh-CN"
+}
+---
+
+## 描述
+`explode_json_array_json_outer` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode_outer` 函数处理,行为等价于:`explode_outer(cast(<json_array> as Array<JSON>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+## 语法
+```sql
+EXPLODE_JSON_ARRAY_JSON_OUTER(<json>)
+```
+
+## 参数
+- `<json>` JSON 类型,其内容应该是数组。
+
+## 返回值
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<JSON>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 1 行 NULL 数据。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('[4,
"abc", {"key": "value"}, 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+-----------------+
+ | k1 | c |
+ +------+-----------------+
+ | 1 | 4 |
+ | 1 | "abc" |
+ | 1 | {"key":"value"} |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+-----------------+
+ ```
+2. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('[]') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+3. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_json_outer(NULL) t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_json_outer('{}') t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json.md
index 7d8ce994784..9995134c60a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-json.md
@@ -6,61 +6,65 @@
---
## 描述
-
-`explode_json_array_json` 表函数,接受一个 JSON 数组,其中每个元素是 JSON 对象类型,将该 JSON 数组中的每个
JSON 对象展开为多行,每行包含一个 JSON 对象。配合 LATERAL VIEW 使用。
+`explode_json_array_json` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode` 函数处理,行为等价于:`explode(cast(<json_array> as Array<JSON>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
## 语法
-
```sql
EXPLODE_JSON_ARRAY_JSON(<json>)
-EXPLODE_JSON_ARRAY_JSON_OUTER(<json>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<json>` | json 类型 |
+- `<json>` JSON 类型,其内容应该是数组。
## 返回值
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<JSON>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 0 行数据。
-展开 JSON 数组,每个元素生成一行,返回 JSON 对象列。
-
-## 举例
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_JSON(json_array) tmp1 AS e1
-WHERE id = 4;
-```
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
-```text
-+------+---------+
-| id | e1 |
-+------+---------+
-| 4 | {"a":1} |
-| 4 | {"b":2} |
-| 4 | {"c":3} |
-+------+---------+
-```
\ No newline at end of file
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_json('[4, "abc",
{"key": "value"}, 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+-----------------+
+ | k1 | c |
+ +------+-----------------+
+ | 1 | 4 |
+ | 1 | NULL |
+ | 1 | {"key":"value"} |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+-----------------+
+ ```
+2. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_json('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+3. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_json(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_json('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string-outer.md
new file mode 100644
index 00000000000..c0b1ae99eb8
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string-outer.md
@@ -0,0 +1,83 @@
+---
+{
+"title": "EXPLODE_JSON_ARRAY_STRING_OUTER",
+"language": "zh-CN"
+}
+---
+
+## 描述
+`explode_json_array_string_outer` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode_outer` 函数处理,行为等价于:`explode_outer(cast(<json_array> as Array<STRING>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+## 语法
+```sql
+EXPLODE_JSON_ARRAY_STRING_OUTER(<json>)
+```
+
+## 参数
+- `<json>` JSON 类型,其内容应该是数组。
+
+## 返回值
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<STRING>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 1 行 NULL 数据。
+- 如果 JSON 数组的元素不是 INT 类型,会尝试将其转换为 STRING,如果无法转换为 STRING 类型会被转换为
NULL,关于类型转换的规则请参考 [JSON
类型转换](../../basic-element/sql-data-types/conversion/json-conversion.md)。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_string_outer('[4,
"5", "abc", 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | abc |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_string_outer('[]')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+3. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_string_outer(NULL)
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_string_outer('{}')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string.md
index 003539ecd0d..ed0ae005b73 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-json-array-string.md
@@ -6,90 +6,66 @@
---
## 描述
-
-`explode_json_array_string` 表函数,接受一个 JSON 数组,其中每个元素是字符串类型,将该 JSON
数组中的每个字符串展开为多行,每行包含一个字符串。配合 LATERAL VIEW 使用。
-
-`explode_json_array_string_outer` 和 `explode_json_array_string` 类似,对于空值或 NULL
的处理不同。
-
-如果 JSON 字符串本身为 NULL,`OUTER` 版本会返回一行,且该行中的值为 NULL。普通版本会完全忽略这类记录。
-
-如果 JSON 数组为空,`OUTER` 版本会返回一行,且该行的值为 NULL。普通版本则不会返回任何结果。
+`explode_json_array_string` 表函数,接受一个 JSON 数组,其实现逻辑是将 JSON 数组转换为数组类型然后再调用
`explode` 函数处理,行为等价于:`explode(cast(<json_array> as Array<STRING>))`
+。需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
## 语法
-
```sql
EXPLODE_JSON_ARRAY_STRING(<json>)
-EXPLODE_JSON_ARRAY_STRING_OUTER(<json>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<json>` | json 类型 |
+- `<json>` JSON 类型,其内容应该是数组。
## 返回值
-
-展开 JSON 数组,每个元素生成一行,返回整数列。
-
-## 举例
-
-```sql
-CREATE TABLE json_array_example (
- id INT,
- json_array STRING
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(id) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-INSERT INTO json_array_example (id, json_array) VALUES
-(1, '[1, 2, 3, 4, 5]'),
-(2, '[1.1, 2.2, 3.3, 4.4]'),
-(3, '["apple", "banana", "cherry"]'),
-(4, '[{"a": 1}, {"b": 2}, {"c": 3}]'),
-(5, '[]'),
-(6, 'NULL');
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_STRING(json_array) tmp1 AS e1
-WHERE id = 3;
-```
-
-```text
-+------+--------+
-| id | e1 |
-+------+--------+
-| 3 | apple |
-| 3 | banana |
-| 3 | cherry |
-+------+--------+
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_STRING(json_array) tmp1 AS e1
-WHERE id = 6;
-Empty set (0.02 sec)
-```
-
-```sql
-SELECT id, e1
-FROM json_array_example
-LATERAL VIEW EXPLODE_JSON_ARRAY_STRING_OUTER(json_array) tmp1 AS e1
-WHERE id = 6;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 6 | NULL |
-+------+------+
-```
\ No newline at end of file
+- 返回由 `<json>` 所有元素组成的单列多行数据,列类型为 `Nullable<STRING>`。
+- 如果 `<json>` 为 NULL 或者为空数组(元素个数为 0),返回 0 行数据。
+- 如果 JSON 数组的元素不是 STRING 类型,会尝试将其转换为 STRING,如果无法转换为 STRING 类型会被转换为
NULL,关于类型转换的规则请参考 [JSON
类型转换](../../basic-element/sql-data-types/conversion/json-conversion.md)。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from example lateral view explode_json_array_string('[4, "5",
"abc", 5.23, null]') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | 4 |
+ | 1 | 5 |
+ | 1 | abc |
+ | 1 | 5.23 |
+ | 1 | NULL |
+ +------+------+
+ ```
+2. 空数组
+ ```sql
+ select * from example lateral view explode_json_array_string('[]') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+3. NULL 参数
+ ```sql
+ select * from example lateral view explode_json_array_string(NULL) t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. 非数组参数
+ ```sql
+ select * from example lateral view explode_json_array_string('{}') t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index 0d80936380a..fd432f1dfa8 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1857,9 +1857,13 @@
"sql-manual/sql-functions/table-functions/explode",
"sql-manual/sql-functions/table-functions/explode-bitmap",
"sql-manual/sql-functions/table-functions/explode-json-array-double",
+
"sql-manual/sql-functions/table-functions/explode-json-array-double-outer",
"sql-manual/sql-functions/table-functions/explode-json-array-int",
+
"sql-manual/sql-functions/table-functions/explode-json-array-int-outer",
"sql-manual/sql-functions/table-functions/explode-json-array-json",
+
"sql-manual/sql-functions/table-functions/explode-json-array-json-outer",
"sql-manual/sql-functions/table-functions/explode-json-array-string",
+
"sql-manual/sql-functions/table-functions/explode-json-array-string-outer",
"sql-manual/sql-functions/table-functions/explode-json-object",
"sql-manual/sql-functions/table-functions/explode-map",
"sql-manual/sql-functions/table-functions/explode-numbers",
@@ -2446,4 +2450,4 @@
]
}
]
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]