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 a7fe65fd68a update explode_split (#2754)
a7fe65fd68a is described below
commit a7fe65fd68a2d6db643653325a04c1ca268c49b5
Author: Jerry Hu <[email protected]>
AuthorDate: Mon Aug 18 12:17:39 2025 +0800
update explode_split (#2754)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../table-functions/explode-split-outer.md | 110 +++++++++++
.../sql-functions/table-functions/explode-split.md | 211 ++++++++------------
.../table-functions/explode-split-outer.md | 110 +++++++++++
.../sql-functions/table-functions/explode-split.md | 216 ++++++++-------------
sidebars.json | 1 +
5 files changed, 388 insertions(+), 260 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/table-functions/explode-split-outer.md
b/docs/sql-manual/sql-functions/table-functions/explode-split-outer.md
new file mode 100644
index 00000000000..0e6c5e394af
--- /dev/null
+++ b/docs/sql-manual/sql-functions/table-functions/explode-split-outer.md
@@ -0,0 +1,110 @@
+---
+{
+ "title": "EXPLODE_SPLIT_OUTER",
+ "language": "en"
+}
+---
+
+## Description
+The `explode_split_outer` table function is used to split a string into
multiple substrings according to the specified delimiter, and expand each
substring into a separate row.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md) to flatten nested data structures
into a standard flat table format.
+The main difference between `explode_split_outer` and
[`explode_split`](./explode-split.md) is how they handle null values.
+
+## Syntax
+```sql
+EXPLODE_SPLIT_OUTER(<str>, <delimiter>)
+```
+
+## Parameters
+- `<str>` String type, the string to be split.
+- `<delimiter>` String type, the delimiter.
+
+## Return Value
+- Returns a column composed of the split substrings, with column type String.
+
+## Usage Notes
+1. If `<str>` is NULL, 1 row with NULL is returned.
+2. If `<str>` is an empty string ("") or cannot be split, 1 row is returned.
+3. If `<delimiter>` is NULL, 1 row with NULL is returned.
+4. If `<delimiter>` is an empty string (""), `<str>` will be split by
bytes([`SPLIT_BY_STRING`](../scalar-functions/string-functions/split-by-string.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 (select 1 as k1) t1 lateral view
explode_split_outer("ab,cd,ef", ",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | ab |
+ | 1 | cd |
+ | 1 | ef |
+ +------+------+
+ ```
+2. Empty string and unsplittable cases
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer("",
",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | |
+ +------+------+
+ ```
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer("abc",
",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | abc |
+ +------+------+
+ ```
+3. NULL parameter
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer(NULL,
',') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. Empty delimiter
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer('abc',
'') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | a |
+ | 1 | b |
+ | 1 | c |
+ +------+------+
+ ```
+5. Delimiter is NULL
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer('abc',
null) 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-split.md
b/docs/sql-manual/sql-functions/table-functions/explode-split.md
index 37a5c503c08..3d78310fbf5 100644
--- a/docs/sql-manual/sql-functions/table-functions/explode-split.md
+++ b/docs/sql-manual/sql-functions/table-functions/explode-split.md
@@ -6,144 +6,97 @@
---
## Description
-
-The `explode_split` table function is used to split a string into multiple
substrings based on a specified delimiter and expand each substring into a
separate row. Each substring is returned as an individual row, and it is
typically used with LATERAL VIEW to break down long strings into individual
parts for more granular queries.
-
-`explode_split_outer` is similar to `explode_split`, but it differs in the way
it handles empty or NULL strings.
+The `explode_split` table function is used to split a string into multiple
substrings according to the specified delimiter, and expand each substring into
a separate row.
+It should be used together with [`LATERAL
VIEW`](../../../query-data/lateral-view.md) to flatten nested data structures
into a standard flat table format.
+The main difference between `explode_split` and
[`explode_split_outer`](./explode-split-outer.md) is how they handle null
values.
## Syntax
-
```sql
EXPLODE_SPLIT(<str>, <delimiter>)
-EXPLODE_SPLIT_OUTER(<str>, <delimiter>)
```
## Parameters
-
-| Parameter | Description |
-| -- | -- |
-| `<str>` | String type |
-| `<delimiter>` | Delimiter |
+- `<str>` String type, the string to be split.
+- `<delimiter>` String type, the delimiter.
## Return Value
+- Returns a column composed of the split substrings, with column type String.
-Returns a sequence of the split substrings. If the string is empty or NULL, no
rows are returned.
+## Usage Notes
+1. If `<str>` is NULL, 0 rows are returned.
+2. If `<str>` is an empty string ("") or cannot be split, 1 row is returned.
+3. If `<delimiter>` is NULL, 0 rows are returned.
+4. If `<delimiter>` is an empty string (""), `<str>` will be split by
bytes([`SPLIT_BY_STRING`](../scalar-functions/string-functions/split-by-string.md)).
## Examples
-
-```sql
-select * from example1 order by k1;
-```
-
-```text
-+------+---------+
-| k1 | k2 |
-+------+---------+
-| 1 | |
-| 2 | NULL |
-| 3 | , |
-| 4 | 1 |
-| 5 | 1,2,3 |
-| 6 | a, b, c |
-+------+---------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 1 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 1 | |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 2 order by k1, e1;
-Empty set
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 3 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 3 | |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 4 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 4 | 1 |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 5 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 5 | 2 |
-| 5 | 3 |
-| 5 | 1 |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 6 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 6 | b |
-| 6 | c |
-| 6 | a |
-+------+------+
-```
-
-```sql
-CREATE TABLE example2 (
- id INT,
- str string null
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-insert into example2 values (1,''),(2,NUll),(3,"1"),(4,"1,2,3"),(5,"a,b,c");
-```
-
-```sql
-select id, e1 from example2 lateral view explode_split(str, ',') tmp1 as e1
where id = 2 order by id, e1;
-Empty set (0.02 sec)
-```
-
-```sql
-select id, e1 from example2 lateral view explode_split_outer(str, ',') tmp1 as
e1 where id = 2 order by id, e1;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 2 | 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 (select 1 as k1) t1 lateral view explode_split("ab,cd,ef",
",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | ab |
+ | 1 | cd |
+ | 1 | ef |
+ +------+------+
+ ```
+2. Empty string and unsplittable cases
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split("", ",") t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | |
+ +------+------+
+ ```
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split("abc", ",")
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | abc |
+ +------+------+
+ ```
+3. NULL parameter
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split(NULL, ',')
t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. Empty delimiter
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split('abc', '')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | a |
+ | 1 | b |
+ | 1 | c |
+ +------+------+
+ ```
+5. Delimiter is NULL
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split('abc', null)
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-split-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-split-outer.md
new file mode 100644
index 00000000000..9ca6fa207cb
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-split-outer.md
@@ -0,0 +1,110 @@
+---
+{
+ "title": "EXPLODE_SPLIT_OUTER",
+ "language": "zh-CN"
+}
+---
+
+## 描述
+`explode_split_outer` 表函数用于将字符串按照指定分隔符拆分为多个子字符串,并将每个子字符串展开为一行。
+需要与 [`LATERAL VIEW`](../../../query-data/lateral-view.md)
配合使用,以将嵌套数据结构展开为标准的平面表格式。
+`explode_split_outer` 和 [`explode_split`](./explode-split.md) 区别主要在于空值处理。
+
+## 语法
+```sql
+EXPLODE_SPLIT_OUTER(<str>, <delimiter>)
+```
+
+## 参数
+- `<str>` String 类型,要分隔的字符串。
+- `<delimiter>` String 类型,分隔符。
+
+## 返回值
+- 返回由分隔后的字符串组成的列,列类型为 String。
+
+## 使用说明
+1. `<str>` 为 NULL 时返回 1 行 NULL 数据。
+2. `<str>` 为空字符串("")或者无法被拆分时,会返回一行数据。
+3. `<delimiter>` 为 NULL 时返回 1 行 NULL 数据。
+4. `<delimiter>` 为空字符串("") 时,`<str>`
会被按字节进行拆分(参考:[`SPLIT_BY_STRING`](../scalar-functions/string-functions/split-by-string.md))。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from (select 1 as k1) t1 lateral view
explode_split_outer("ab,cd,ef", ",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | ab |
+ | 1 | cd |
+ | 1 | ef |
+ +------+------+
+ ```
+2. 空字符串和无法分隔的情况
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer("",
",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | |
+ +------+------+
+ ```
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer("abc",
",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | abc |
+ +------+------+
+ ```
+3. NULL 参数
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer(NULL,
',') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | NULL |
+ +------+------+
+ ```
+4. 空的分隔符
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer('abc',
'') t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | a |
+ | 1 | b |
+ | 1 | c |
+ +------+------+
+ ```
+5. 分隔符为 NULL
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split_outer('abc',
null) 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-split.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-split.md
index 79e11e4ff71..6418e7548b3 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-split.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/explode-split.md
@@ -6,143 +6,97 @@
---
## 描述
-
-`explode_split` 表函数用于将字符串按照指定分隔符拆分为多个子字符串,并将每个子字符串展开为一行。每个子字符串作为单独的行返回,通常与
LATERAL VIEW 一起使用,便于将长字符串拆解为单独的部分,进行更细粒度的查询。
-
-`explode_split_outer` 与 `explode_split` 类似。但与 `explode_split` 不同的是,它在处理空值和
NULL 值时会有不同的行为,能够处理空的或 NULL 的字符串。
+`explode_split` 表函数用于将字符串按照指定分隔符拆分为多个子字符串,并将每个子字符串展开为一行。
+需要与 [`LATERAL VIEW`](../../../query-data/lateral-view.md)
配合使用,以将嵌套数据结构展开为标准的平面表格式。
+`explode_split` 和 [`explode_split_outer`](./explode-split-outer.md) 区别主要在于空值处理。
## 语法
```sql
EXPLODE_SPLIT(<str>, <delimiter>)
-EXPLODE_SPLIT_OUTER(<str>, <delimiter>)
```
## 参数
-
-| 参数 | 说明 |
-| -- | -- |
-| `<str>` | 字符串类型 |
-| `<delimiter>` | 分割符 |
+- `<str>` String 类型,要分隔的字符串。
+- `<delimiter>` String 类型,分隔符。
## 返回值
-
-返回拆分后的子字符串序列。如果字符串为空或 NULL,不返回任何行。
-
-## 举例
-
-```sql
-select * from example1 order by k1;
-```
-
-```text
-+------+---------+
-| k1 | k2 |
-+------+---------+
-| 1 | |
-| 2 | NULL |
-| 3 | , |
-| 4 | 1 |
-| 5 | 1,2,3 |
-| 6 | a, b, c |
-+------+---------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 1 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 1 | |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 2 order by k1, e1;
-Empty set
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 3 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 3 | |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 4 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 4 | 1 |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 5 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 5 | 2 |
-| 5 | 3 |
-| 5 | 1 |
-+------+------+
-```
-
-```sql
-select k1, e1 from example1 lateral view explode_split(k2, ',') tmp1 as e1
where k1 = 6 order by k1, e1;
-```
-
-```text
-+------+------+
-| k1 | e1 |
-+------+------+
-| 6 | b |
-| 6 | c |
-| 6 | a |
-+------+------+
-```
-
-```sql
-CREATE TABLE example2 (
- id INT,
- str string null
-)DUPLICATE KEY(id)
-DISTRIBUTED BY HASH(`id`) BUCKETS AUTO
-PROPERTIES (
-"replication_allocation" = "tag.location.default: 1");
-```
-
-```sql
-insert into example2 values (1,''),(2,NUll),(3,"1"),(4,"1,2,3"),(5,"a,b,c");
-```
-
-```sql
-select id, e1 from example2 lateral view explode_split(str, ',') tmp1 as e1
where id = 2 order by id, e1;
-Empty set (0.02 sec)
-```
-
-```sql
-select id, e1 from example2 lateral view explode_split_outer(str, ',') tmp1 as
e1 where id = 2 order by id, e1;
-```
-
-```text
-+------+------+
-| id | e1 |
-+------+------+
-| 2 | NULL |
-+------+------+
-```
\ No newline at end of file
+- 返回由分隔后的字符串组成的列,列类型为 String。
+
+## 使用说明
+1. `<str>` 为 NULL 时返回 0 行数据。
+2. `<str>` 为空字符串("")或者无法被拆分时,会返回一行数据。
+3. `<delimiter>` 如果为 NULL,会返回 0 行数据。
+4. `<delimiter>` 如果为空字符串(""),`<str>`
会被按字节进行拆分(参考:[`SPLIT_BY_STRING`](../scalar-functions/string-functions/split-by-string.md))。
+
+## 示例
+0. 准备数据
+ ```sql
+ create table example(
+ k1 int
+ ) properties(
+ "replication_num" = "1"
+ );
+
+ insert into example values(1);
+ ```
+1. 常规参数
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split("ab,cd,ef",
",") t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | ab |
+ | 1 | cd |
+ | 1 | ef |
+ +------+------+
+ ```
+2. 空字符串和无法分隔的情况
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split("", ",") t2
as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | |
+ +------+------+
+ ```
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split("abc", ",")
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | abc |
+ +------+------+
+ ```
+3. NULL 参数
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split(NULL, ',')
t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
+4. 空的分隔符
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split('abc', '')
t2 as c;
+ ```
+ ```text
+ +------+------+
+ | k1 | c |
+ +------+------+
+ | 1 | a |
+ | 1 | b |
+ | 1 | c |
+ +------+------+
+ ```
+5. 分隔符为 NULL
+ ```sql
+ select * from (select 1 as k1) t1 lateral view explode_split('abc', null)
t2 as c;
+ ```
+ ```text
+ Empty set (0.03 sec)
+ ```
\ No newline at end of file
diff --git a/sidebars.json b/sidebars.json
index fd432f1dfa8..5940d4ca8c5 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1868,6 +1868,7 @@
"sql-manual/sql-functions/table-functions/explode-map",
"sql-manual/sql-functions/table-functions/explode-numbers",
"sql-manual/sql-functions/table-functions/explode-split",
+
"sql-manual/sql-functions/table-functions/explode-split-outer",
"sql-manual/sql-functions/table-functions/posexplode"
]
},
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]