Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/sql-manual/sql-functions/table-functions/unnest.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in docs/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

i18n-sync-locale-candidate

Japanese docs are report-only. Generate a candidate translation from the changed files and merge it only after human review. Owner%3A @apache/doris-website-maintainers

Check warning on line 1 in docs/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

frontmatter-description-required

Missing required front matter field%3A description. Owner%3A @apache/doris-website-maintainers
{
"title": "UNNEST",
"language": "en-US"
Expand All @@ -22,7 +22,7 @@
- Multiple ARRAY parameters: Combines the elements expanded each time into multiple columns (or as a Struct) by position. The expansion length is determined by the longest input, and shorter columns are padded with NULL.
- MAP parameter: Returns two columns (Struct) (key, value); NULL keys/values remain NULL.
- BITMAP parameter: Returns integer values by element.
- WITH ORDINALITY: Appends a sequence number column starting from 1 to the output (as the last column or specified by an alias).
- WITH ORDINALITY: Appends a sequence number column starting from 0 to the output (as the first column or specified by an alias).
- Empty array or NULL:
- When generating an independent table (SELECT list or FROM ... UNNEST), if the parameter is NULL or an empty array, no rows are generated (0 rows).
- When used in combination with FROM/LATERAL and LEFT JOIN (i.e., generating outer row semantics), if all expanded rows of a parent row are filtered or have no output, a row is inserted for the parent row, with the UNNEST output columns set to NULL (to retain the left table row).
Expand All @@ -34,7 +34,7 @@
4. In JOIN scenarios:
- INNER / CROSS JOIN: Performs Cartesian product or matching based on the expanded results.
- LEFT JOIN LATERAL: Implements outer row semantics — if there are no matches or all expanded results are filtered by ON/filter conditions, a row with NULL values is generated (to retain the left table row).
5. WITH ORDINALITY adds a sequence number (starting from 1) to the expanded rows.
5. WITH ORDINALITY adds a sequence number (starting from 0) to the expanded rows.
6. When UNNEST(...) is used directly in the SELECT list, it is equivalent to applying the table-generating function to a single-row source, expanding the expression into multiple rows of output.

## Examples
Expand Down Expand Up @@ -102,14 +102,14 @@
```
3. WITH ORDINALITY:
```sql
SELECT i.id, t.ord, t.tag
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(tag, ord)
SELECT i.id, t.tag, t.ord
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(ord, tag)
ORDER BY i.id, t.ord;
```
Output (example):
```sql
+------+-------------+------+
| id | ord | tag |
| id | tag | ord |
+------+-------------+------+
| 1 | Electronics | 0 |
| 1 | High-End | 2 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

frontmatter-description-required

Missing required front matter field%3A description. Owner%3A @apache/doris-website-maintainers
{
"title": "UNNEST",
"language": "zh-CN"
Expand All @@ -9,7 +9,7 @@
`unnest` 将数组/集合/映射类型表达式展开为多行(表生成函数)。支持在 SELECT 列表、FROM 中使用,并支持 WITH ORDINALITY 为每个展开行附加序号。与 `explode` 系列函数类似,但 `unnest` 支持多参数、Map 与 Bitmap 等类型,并在 FROM/LATERAL 与 JOIN 场景下支持 LEFT (outer) 语义。

## 语法
```sql

Check warning on line 12 in i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @apache/doris-website-maintainers
UNNEST(<expr>[, ...]) [WITH ORDINALITY] [AS alias [(col1, col2, ...)]]
-- 可在 FROM 子句前加 LATERAL: LATERAL UNNEST(...), LATERAL是个可选关键字
```
Expand All @@ -22,7 +22,7 @@
- 多个 ARRAY 参数:将每次展开的元素按位置组合为多列(或作为 Struct),展开长度由最长输入决定,短列用 NULL 补齐。
- MAP 参数:返回 (key, value) 两列(Struct);NULL key/value 保持 NULL。
- BITMAP 参数:按元素返回整型。
- WITH ORDINALITY:在输出中附加一个从 1 开始的序号列(作为最后一列或由别名指定)。
- WITH ORDINALITY:在输出中附加一个从 0 开始的序号列(作为第一列或由别名指定)。
- 空数组或 NULL:
- 作为独立表生成(SELECT 列表或 FROM ... UNNEST)时,若参数为 NULL 或空数组,不产生行(0 行)。
- 在 FROM/LATERAL 与 LEFT JOIN 联合使用时(即产生 outer 行语义),若某个父行的所有展开行被过滤或无输出,会为该父行插入一行,其中 UNNEST 输出列为 NULL(以保留左表行)。
Expand All @@ -34,7 +34,7 @@
4. 在 JOIN 场景:
- INNER / CROSS JOIN:按展开结果做笛卡尔或匹配。
- LEFT JOIN LATERAL:实现 outer 行语义——若没有匹配或展开结果被 ON/过滤条件全部过滤,会产生一行 NULL(保持左表行)。
5. WITH ORDINALITY 为展开行增加序号(1 起)。
5. WITH ORDINALITY 为展开行增加序号(0 起)。
6. 在 SELECT 列表直接使用 `UNNEST(...)` 时,等价于对一个单行源应用表生成函数,会把该表达式展开为多行输出。

## 示例
Expand Down Expand Up @@ -102,14 +102,14 @@
```
3. WITH ORDINALITY:
```sql
SELECT i.id, t.ord, t.tag
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(tag, ord)
SELECT i.id, t.tag, t.ord
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(ord, tag)
ORDER BY i.id, t.ord;
```
输出(示例):
```sql
+------+-------------+------+
| id | ord | tag |
| id | tag | ord |
+------+-------------+------+
| 1 | Electronics | 0 |
| 1 | High-End | 2 |
Expand Down Expand Up @@ -153,7 +153,7 @@
| id | tag | name |
+------+--------+---------------------+
| 1 | Laptop | Laptop |
| 2 | NULL | Mechanical Keyboard |

Check warning on line 156 in i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @apache/doris-website-maintainers
| 3 | NULL | Basketball |
| 4 | NULL | Badminton Racket |
| 5 | Shirt | Shirt |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

frontmatter-description-required

Missing required front matter field%3A description. Owner%3A @zclllyybb
{
"title": "UNNEST",
"language": "zh-CN"
Expand All @@ -9,7 +9,7 @@
`unnest` 将数组/集合/映射类型表达式展开为多行(表生成函数)。支持在 SELECT 列表、FROM 中使用,并支持 WITH ORDINALITY 为每个展开行附加序号。与 `explode` 系列函数类似,但 `unnest` 支持多参数、Map 与 Bitmap 等类型,并在 FROM/LATERAL 与 JOIN 场景下支持 LEFT (outer) 语义。

## 语法
```sql

Check warning on line 12 in i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @zclllyybb
UNNEST(<expr>[, ...]) [WITH ORDINALITY] [AS alias [(col1, col2, ...)]]
-- 可在 FROM 子句前加 LATERAL: LATERAL UNNEST(...), LATERAL是个可选关键字
```
Expand All @@ -22,7 +22,7 @@
- 多个 ARRAY 参数:将每次展开的元素按位置组合为多列(或作为 Struct),展开长度由最长输入决定,短列用 NULL 补齐。
- MAP 参数:返回 (key, value) 两列(Struct);NULL key/value 保持 NULL。
- BITMAP 参数:按元素返回整型。
- WITH ORDINALITY:在输出中附加一个从 1 开始的序号列(作为最后一列或由别名指定)。
- WITH ORDINALITY:在输出中附加一个从 0 开始的序号列(作为第一列或由别名指定)。
- 空数组或 NULL:
- 作为独立表生成(SELECT 列表或 FROM ... UNNEST)时,若参数为 NULL 或空数组,不产生行(0 行)。
- 在 FROM/LATERAL 与 LEFT JOIN 联合使用时(即产生 outer 行语义),若某个父行的所有展开行被过滤或无输出,会为该父行插入一行,其中 UNNEST 输出列为 NULL(以保留左表行)。
Expand All @@ -34,7 +34,7 @@
4. 在 JOIN 场景:
- INNER / CROSS JOIN:按展开结果做笛卡尔或匹配。
- LEFT JOIN LATERAL:实现 outer 行语义——若没有匹配或展开结果被 ON/过滤条件全部过滤,会产生一行 NULL(保持左表行)。
5. WITH ORDINALITY 为展开行增加序号(1 起)。
5. WITH ORDINALITY 为展开行增加序号(0 起)。
6. 在 SELECT 列表直接使用 `UNNEST(...)` 时,等价于对一个单行源应用表生成函数,会把该表达式展开为多行输出。

## 示例
Expand Down Expand Up @@ -102,14 +102,14 @@
```
3. WITH ORDINALITY:
```sql
SELECT i.id, t.ord, t.tag
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(tag, ord)
SELECT i.id, t.tag, t.ord
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(ord, tag)
ORDER BY i.id, t.ord;
```
输出(示例):
```sql
+------+-------------+------+
| id | ord | tag |
| id | tag | ord |
+------+-------------+------+
| 1 | Electronics | 0 |
| 1 | High-End | 2 |
Expand Down Expand Up @@ -153,7 +153,7 @@
| id | tag | name |
+------+--------+---------------------+
| 1 | Laptop | Laptop |
| 2 | NULL | Mechanical Keyboard |

Check warning on line 156 in i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @zclllyybb
| 3 | NULL | Basketball |
| 4 | NULL | Badminton Racket |
| 5 | Shirt | Shirt |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check warning on line 1 in ja-source/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

frontmatter-description-required

Missing required front matter field%3A description. Owner%3A @apache/doris-website-maintainers
{
"title": "UNNEST",
"language": "ja"
Expand All @@ -8,7 +8,7 @@
`unnest`は、配列/コレクション/マップ型の式を複数行に展開する(テーブル生成関数)。SELECT リストと FROM 句で使用でき、WITH ORDINALITY をサポートして各展開行に連番を追加する。`explode` シリーズの関数と同様に、`unnest` は複数のパラメータ、Map や Bitmap などの型をサポートし、FROM/LATERAL や JOIN シナリオにおいて LEFT(外部)セマンティクスもサポートする。

## 構文

Check warning on line 11 in ja-source/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-cjk-spacing

Chinese text should contain spaces around adjacent English words or numbers. Owner%3A @apache/doris-website-maintainers
```sql
UNNEST(<expr>[, ...]) [WITH ORDINALITY] [AS alias [(col1, col2, ...)]]
-- LATERAL can be added before the FROM clause: LATERAL UNNEST(...), where LATERAL is an optional keyword
Expand All @@ -21,7 +21,7 @@
- 複数のARRAYパラメータ:位置によって各回展開された要素を複数列(またはStruct)に結合する。展開の長さは最も長い入力によって決定され、短い列はNULLでパディングされる。
- MAPパラメータ:2列(Struct)(key、value)を返す;NULLキー/値はNULLのまま。
- BITMAPパラメータ:要素ごとに整数値を返す。
- WITH ORDINALITY:1から始まるシーケンス番号列を出力に追加する(最後の列として、またはエイリアスで指定された位置に)。
- WITH ORDINALITY:0から始まるシーケンス番号列を出力に追加する(最初の列として、またはエイリアスで指定された位置に)。
- 空配列またはNULL:
- 独立したテーブルを生成する場合(SELECTリストまたはFROM ... UNNEST)、パラメータがNULLまたは空配列の場合、行は生成されない(0行)。
- FROM/LATERALとLEFT JOINの組み合わせで使用される場合(つまり、外部行セマンティクスを生成)、親行の展開された行がすべてフィルタリングされるか出力がない場合、親行のために行が挿入され、UNNEST出力列はNULLに設定される(左テーブル行を保持するため)。
Expand All @@ -33,7 +33,7 @@
4. JOINシナリオにおいて:
- INNER / CROSS JOIN:展開結果に基づいてデカルト積またはマッチングを実行する。
- LEFT JOIN LATERAL:外部行セマンティクスを実装する — マッチがないか、すべての展開結果がON/フィルタ条件によってフィルタリングされた場合、NULL値を持つ行が生成される(左テーブル行を保持するため)。
5. WITH ORDINALITYは展開された行にシーケンス番号(1から開始)を追加する。
5. WITH ORDINALITYは展開された行にシーケンス番号(0から開始)を追加する。
6. UNNEST(...)がSELECTリストで直接使用される場合、単一行ソースにテーブル生成関数を適用することと同等であり、式を複数行の出力に展開する。

## 例
Expand Down Expand Up @@ -107,15 +107,15 @@
3. WITH ORDINALITY:

```sql
SELECT i.id, t.ord, t.tag
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(tag, ord)
SELECT i.id, t.tag, t.ord
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(ord, tag)
ORDER BY i.id, t.ord;
```
出力(例):

```sql
+------+-------------+------+
| id | ord | tag |
| id | tag | ord |
+------+-------------+------+
| 1 | Electronics | 0 |
| 1 | High-End | 2 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

i18n-sync-locale-candidate

Japanese docs are report-only. Generate a candidate translation from the changed files and merge it only after human review. Owner%3A @zclllyybb

Check warning on line 1 in versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/unnest.md

View workflow job for this annotation

GitHub Actions / Build Check

frontmatter-description-required

Missing required front matter field%3A description. Owner%3A @zclllyybb
{
"title": "UNNEST",
"language": "en-US"
Expand All @@ -22,7 +22,7 @@
- Multiple ARRAY parameters: Combines the elements expanded each time into multiple columns (or as a Struct) by position. The expansion length is determined by the longest input, and shorter columns are padded with NULL.
- MAP parameter: Returns two columns (Struct) (key, value); NULL keys/values remain NULL.
- BITMAP parameter: Returns integer values by element.
- WITH ORDINALITY: Appends a sequence number column starting from 1 to the output (as the last column or specified by an alias).
- WITH ORDINALITY: Appends a sequence number column starting from 0 to the output (as the first column or specified by an alias).
- Empty array or NULL:
- When generating an independent table (SELECT list or FROM ... UNNEST), if the parameter is NULL or an empty array, no rows are generated (0 rows).
- When used in combination with FROM/LATERAL and LEFT JOIN (i.e., generating outer row semantics), if all expanded rows of a parent row are filtered or have no output, a row is inserted for the parent row, with the UNNEST output columns set to NULL (to retain the left table row).
Expand All @@ -34,7 +34,7 @@
4. In JOIN scenarios:
- INNER / CROSS JOIN: Performs Cartesian product or matching based on the expanded results.
- LEFT JOIN LATERAL: Implements outer row semantics — if there are no matches or all expanded results are filtered by ON/filter conditions, a row with NULL values is generated (to retain the left table row).
5. WITH ORDINALITY adds a sequence number (starting from 1) to the expanded rows.
5. WITH ORDINALITY adds a sequence number (starting from 0) to the expanded rows.
6. When UNNEST(...) is used directly in the SELECT list, it is equivalent to applying the table-generating function to a single-row source, expanding the expression into multiple rows of output.

## Examples
Expand Down Expand Up @@ -102,14 +102,14 @@
```
3. WITH ORDINALITY:
```sql
SELECT i.id, t.ord, t.tag
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(tag, ord)
SELECT i.id, t.tag, t.ord
FROM items i, unnest(i.tags) WITH ORDINALITY AS t(ord, tag)
ORDER BY i.id, t.ord;
```
Output (example):
```sql
+------+-------------+------+
| id | ord | tag |
| id | tag | ord |
+------+-------------+------+
| 1 | Electronics | 0 |
| 1 | High-End | 2 |
Expand Down
Loading