This is an automated email from the ASF dual-hosted git repository.
kassiez 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 209f0a10108 [doc] translate explode json array double (#1932)
209f0a10108 is described below
commit 209f0a1010827e83a49ba237bca7ee4d5055cb0d
Author: CosmosNi <[email protected]>
AuthorDate: Wed Feb 12 16:37:35 2025 +0800
[doc] translate explode json array double (#1932)
## Versions
- [x] 2.1
## Languages
- [x] Chinese
## Docs Checklist
- [x] Checked by AI
- [x] Test Cases Built
---
.../{posexplode-outer.md => posexplode.md} | 70 +++++++++++++++-------
1 file changed, 49 insertions(+), 21 deletions(-)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-functions/posexplode-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-functions/posexplode.md
similarity index 67%
rename from
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-functions/posexplode-outer.md
rename to
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-functions/posexplode.md
index f8260ceb164..eb828f9b30a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-functions/posexplode-outer.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/table-functions/posexplode.md
@@ -1,6 +1,6 @@
---
{
-"title": "posexplode_outer",
+"title": "POSEXPLODE",
"language": "zh-CN"
}
---
@@ -24,35 +24,53 @@ specific language governing permissions and limitations
under the License.
-->
-## Description
+## 描述
-The table function is used in conjunction with Lateral View and can support
multiple Lateral Views. It only supports the new optimizer.
+表函数,需配合 Lateral View使用,并且支持多个Lateral View。它仅支持新的优化器。
-It expands an array column into multiple rows and adds a column indicating the
position, returning a struct type. When the array is NULL or empty,
posexplode_outer returns NULL. Both posexplode and posexplode_outer will return
NULL elements within the array.
+该函数将数组列展开为多行,并添加一个表示位置的列,返回一个结构体类型。当数组为NULL或空时,posexplode_outer会返回
NULL。posexplode和posexplode_outer均会返回数组中的NULL元素。
-## Syntax
+## 语法
```sql
-posexplode(array)
-posexplode_outer(array)
+POSEXPLODE(<array>)
+POSEXPLODE_OUTER(<array>)
```
-### Example
+## 参数
+
+| 参数 | 说明 |
+| -- | -- |
+| `<array>` | 需要被展开为多行的数组 |
+
+
+## 返回值
+
+按照数组array展开的多行。特殊情况:
+
+- 当数组为NULL或空时,返回NULL。
+- 当数组存在NULL元素时,返回NULL元素。
+
+### 举例
```sql
- CREATE TABLE IF NOT EXISTS `table_test`(
- `id` INT NULL,
- `name` TEXT NULL,
- `score` array<string> NULL
- ) ENGINE=OLAP
- DUPLICATE KEY(`id`)
- COMMENT 'OLAP'
- DISTRIBUTED BY HASH(`id`) BUCKETS 1
- PROPERTIES ("replication_allocation" = "tag.location.default: 1");
+CREATE TABLE IF NOT EXISTS `table_test`(
+ `id` INT NULL,
+ `name` TEXT NULL,
+ `score` array<string> NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`id`) BUCKETS 1
+ PROPERTIES ("replication_allocation" = "tag.location.default: 1");
-mysql> insert into table_test values (0, "zhangsan",
["Chinese","Math","English"]),(1, "lisi", ["null"]),(2, "wangwu",
["88a","90b","96c"]),(3, "lisi2", [null]),(4, "amory", NULL);
+insert into table_test values (0, "zhangsan",
["Chinese","Math","English"]),(1, "lisi", ["null"]),(2, "wangwu",
["88a","90b","96c"]),(3, "lisi2", [null]),(4, "amory", NULL);
+```
+```sql
+select * from table_test order by id;
+```
-mysql [test_query_qa]>select * from table_test order by id;
+```text
+------+----------+--------------------------------+
| id | name | score |
+------+----------+--------------------------------+
@@ -62,8 +80,13 @@ mysql [test_query_qa]>select * from table_test order by id;
| 3 | lisi2 | [null] |
| 4 | amory | NULL |
+------+----------+--------------------------------+
+```
+
+```sql
+select id,name,score, k,v from table_test lateral view posexplode(score) tmp
as k,v order by id;
+```
-mysql [test_query_qa]>select id,name,score, k,v from table_test lateral view
posexplode(score) tmp as k,v order by id;
+```text
+------+----------+--------------------------------+------+---------+
| id | name | score | k | v |
+------+----------+--------------------------------+------+---------+
@@ -76,8 +99,13 @@ mysql [test_query_qa]>select id,name,score, k,v from
table_test lateral view pos
| 2 | wangwu | ["88a", "90b", "96c"] | 2 | 96c |
| 3 | lisi2 | [null] | 0 | NULL |
+------+----------+--------------------------------+------+---------+
+```
+
+```sql
+select id,name,score, k,v from table_test lateral view posexplode_outer(score)
tmp as k,v order by id;
+```
-mysql [test_query_qa]>select id,name,score, k,v from table_test lateral view
posexplode_outer(score) tmp as k,v order by id;
+```text
+------+----------+--------------------------------+------+---------+
| id | name | score | k | v |
+------+----------+--------------------------------+------+---------+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]