This is an automated email from the ASF dual-hosted git repository.
zclll 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 b1a80a43b66 [Feature](func) Support table function json_each,
json_each_text (#3422)
b1a80a43b66 is described below
commit b1a80a43b66c26dc0ee02149500e70d4320a34a2
Author: linrrarity <[email protected]>
AuthorDate: Mon Mar 30 21:53:49 2026 +0800
[Feature](func) Support table function json_each, json_each_text (#3422)
## Versions
- [x] dev
- [x] 4.x
- [ ] 3.x
- [ ] 2.1
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../query-data/udf/python-user-defined-function.md | 12 +++
.../table-functions/json-each-outer.md | 91 ++++++++++++++++++
.../table-functions/json-each-text-outer.md | 94 +++++++++++++++++++
.../table-functions/json-each-text.md | 99 ++++++++++++++++++++
.../sql-functions/table-functions/json-each.md | 97 +++++++++++++++++++
.../query-data/udf/python-user-defined-function.md | 12 +++
.../table-functions/json-each-outer.md | 95 +++++++++++++++++++
.../table-functions/json-each-text-outer.md | 98 ++++++++++++++++++++
.../table-functions/json-each-text.md | 103 +++++++++++++++++++++
.../sql-functions/table-functions/json-each.md | 100 ++++++++++++++++++++
.../table-functions/json-each-outer.md | 91 ++++++++++++++++++
.../table-functions/json-each-text-outer.md | 94 +++++++++++++++++++
.../table-functions/json-each-text.md | 103 +++++++++++++++++++++
.../sql-functions/table-functions/json-each.md | 101 ++++++++++++++++++++
sidebars.ts | 4 +
.../table-functions/json-each-outer.md | 95 +++++++++++++++++++
.../table-functions/json-each-text-outer.md | 98 ++++++++++++++++++++
.../table-functions/json-each-text.md | 103 +++++++++++++++++++++
.../sql-functions/table-functions/json-each.md | 101 ++++++++++++++++++++
versioned_sidebars/version-4.x-sidebars.json | 4 +
20 files changed, 1595 insertions(+)
diff --git a/docs/query-data/udf/python-user-defined-function.md
b/docs/query-data/udf/python-user-defined-function.md
index 4f4923c62bb..43bf45e89f9 100644
--- a/docs/query-data/udf/python-user-defined-function.md
+++ b/docs/query-data/udf/python-user-defined-function.md
@@ -182,6 +182,10 @@ In module mode, the `symbol` parameter is used to specify
the function's locatio
- The `module_name` part is used as the module path for dynamic import via
`importlib`
- If `package_name` is specified, the entire path must form a valid Python
import path, and the ZIP package structure must match this path
+:::caution Warning
+Namespaces should be unique and avoid naming conflicts with the Python
standard library or commonly used third-party libraries to prevent dependency
conflicts and runtime exceptions caused by module overshadowing.
+:::
+
**Example Illustrations**:
**Example A: No Package Structure (Two-Part)**
@@ -1286,6 +1290,10 @@ In module mode, the `symbol` parameter is used to
specify the class's location i
- If **two** substrings are obtained, they are `module_name` and `ClassName`
- If **three or more** substrings are obtained, the beginning is
`package_name`, middle is `module_name`, and end is `ClassName`
+:::caution Warning
+Namespaces should be unique and avoid naming conflicts with the Python
standard library or commonly used third-party libraries to prevent dependency
conflicts and runtime exceptions caused by module overshadowing.
+:::
+
**Step 5: Create UDAF Functions**
```sql
@@ -2229,6 +2237,10 @@ In module mode, the `symbol` parameter is used to
specify the function's locatio
- If **two** substrings are obtained, they are `module_name` and
`function_name`
- If **three or more** substrings are obtained, the beginning is
`package_name`, middle is `module_name`, and end is `function_name`
+:::caution Warning
+Namespaces should be unique and avoid naming conflicts with the Python
standard library or commonly used third-party libraries to prevent dependency
conflicts and runtime exceptions caused by module overshadowing.
+:::
+
**Step 5: Create UDTF Functions**
```sql
diff --git a/docs/sql-manual/sql-functions/table-functions/json-each-outer.md
b/docs/sql-manual/sql-functions/table-functions/json-each-outer.md
new file mode 100644
index 00000000000..8ff7abef02d
--- /dev/null
+++ b/docs/sql-manual/sql-functions/table-functions/json-each-outer.md
@@ -0,0 +1,91 @@
+---
+{
+ "title": "JSON_EACH_OUTER",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column retains JSON type. Unlike json_each, returns one
row of NULLs instead of 0 rows when input is NULL or an empty object. Must be
used with LATERAL VIEW."
+}
+---
+
+## Description
+
+The `json_each_outer` table function expands the top-level JSON object into a
set of key/value pairs. Each row contains one key (`key`) and its corresponding
value (`value`). The `value` column retains the JSON type, so string values are
returned with JSON quotes preserved.
+
+Unlike [`json_each`](json-each.md), when the input is NULL or an empty object,
`json_each_outer` returns one row of `NULL, NULL` instead of 0 rows.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+
+```sql
+JSON_EACH_OUTER(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+| ------------ | -------------------------------------------------------------
|
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+| ------- | ------ |
---------------------------------------------------------------------------------------
|
+| `key` | String | The key name from the JSON object
|
+| `value` | JSON | The corresponding value, kept as JSON type (string values
include quotes, e.g. `"foo"`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 1 row of `NULL, NULL`
+- If `<json_str>` is an empty object (`{}`), returns 1 row of `NULL, NULL`
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+NULL parameter: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+Empty object: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/docs/sql-manual/sql-functions/table-functions/json-each-text-outer.md
b/docs/sql-manual/sql-functions/table-functions/json-each-text-outer.md
new file mode 100644
index 00000000000..1d39d64a8c5
--- /dev/null
+++ b/docs/sql-manual/sql-functions/table-functions/json-each-text-outer.md
@@ -0,0 +1,94 @@
+---
+{
+ "title": "JSON_EACH_TEXT_OUTER",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column is returned as plain text. Unlike json_each_text,
returns one row of NULLs instead of 0 rows when input is NULL or an empty
object. Must be used with LATERAL VIEW."
+}
+---
+
+## Description
+
+The `json_each_text_outer` table function expands the top-level JSON object
into a set of key/value pairs. Each row contains one key (`key`) and its
corresponding value (`value`). Unlike [`json_each_outer`](json-each-outer.md),
the `value` column is of type TEXT, so string values are returned **without**
JSON quotes.
+
+Unlike [`json_each_text`](json-each-text.md), when the input is NULL or an
empty object, `json_each_text_outer` returns one row of `NULL, NULL` instead of
0 rows.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+
+```sql
+JSON_EACH_TEXT_OUTER(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+| ------------ | -------------------------------------------------------------
|
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+| ------- | ---- |
--------------------------------------------------------------------------------
|
+| `key` | TEXT | The key name from the JSON object
|
+| `value` | TEXT | The corresponding value as plain text (string values have
no quotes, e.g. `foo`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 1 row of `NULL, NULL`
+- If `<json_str>` is an empty object (`{}`), returns 1 row of `NULL, NULL`
+- A JSON `null` value is returned as SQL `NULL`
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> The `value` column is of TEXT type, so string values have **no** JSON quotes
(unlike `json_each_outer`).
+
+NULL parameter: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+Empty object: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git a/docs/sql-manual/sql-functions/table-functions/json-each-text.md
b/docs/sql-manual/sql-functions/table-functions/json-each-text.md
new file mode 100644
index 00000000000..6d9b6bcaf96
--- /dev/null
+++ b/docs/sql-manual/sql-functions/table-functions/json-each-text.md
@@ -0,0 +1,99 @@
+---
+{
+ "title": "JSON_EACH_TEXT",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column is returned as plain text. Must be used with
LATERAL VIEW."
+}
+---
+
+## Description
+
+The `json_each_text` table function expands the top-level JSON object into a
set of key/value pairs. Each row contains one key (`key`) and its corresponding
value (`value`). Unlike [`json_each`](json-each.md), the `value` column is of
type TEXT, so string values are returned **without** JSON quotes.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+
+```sql
+JSON_EACH_TEXT(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ------------ | ---------------------------------------------------- |
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+|---------|------|--------------------------------------------------------------------------------------|
+| `key` | TEXT | The key name from the JSON object
|
+| `value` | TEXT | The corresponding value as plain text (string values have
no quotes, e.g. `foo`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 0 rows
+- If `<json_str>` is an empty object (`{}`), returns 0 rows
+- A JSON `null` value is returned as SQL `NULL`
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> The `value` column is of TEXT type, so string values have **no** JSON quotes
(unlike `json_each`).
+
+JSON object with multiple value types
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each_text('{"str":"hello","num":42,"bool":true,"null_val":null}') t AS k,
v;
+```
+
+```text
++----------+-------+
+| k | v |
++----------+-------+
+| str | hello |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
++----------+-------+
+```
+
+> JSON `null` values map to SQL `NULL`.
+
+NULL parameter: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text(NULL) t AS k, v;
+-- Empty set
+```
+
+Empty object: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{}') t AS k, v;
+-- Empty set
+```
diff --git a/docs/sql-manual/sql-functions/table-functions/json-each.md
b/docs/sql-manual/sql-functions/table-functions/json-each.md
new file mode 100644
index 00000000000..ade4facfe37
--- /dev/null
+++ b/docs/sql-manual/sql-functions/table-functions/json-each.md
@@ -0,0 +1,97 @@
+---
+{
+ "title": "JSON_EACH",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column retains JSON type. Must be used with LATERAL
VIEW."
+}
+---
+
+## Description
+
+The `json_each` table function expands the top-level JSON object into a set of
key/value pairs. Each row contains one key (`key`) and its corresponding value
(`value`). The `value` column retains the JSON type, so string values are
returned with JSON quotes preserved.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+## Syntax
+
+```sql
+JSON_EACH(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ------------ | ---------------------------------------------------- |
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+|---------|--------|-----------------------------------------------------------------------------|
+| `key` | String | The key name from the JSON object
|
+| `value` | JSON | The corresponding value, kept as JSON type (string values
include quotes, e.g. `"foo"`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 0 rows
+- If `<json_str>` is an empty object (`{}`), returns 0 rows
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+> The `value` column is of JSON type, so string values retain their JSON
quotes.
+
+JSON object with multiple value types
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each('{"str":"hello","num":42,"bool":true,"null_val":null,"arr":[1,2]}') t
AS k, v;
+```
+
+```text
++----------+---------+
+| k | v |
++----------+---------+
+| str | "hello" |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
+| arr | [1,2] |
++----------+---------+
+```
+
+NULL parameter: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each(NULL) t AS k, v;
+-- Empty set
+```
+
+Empty object: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{}') t AS k, v;
+-- Empty set
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md
index 58d2a623630..3bb626a9122 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md
@@ -182,6 +182,10 @@ Python 模块压缩包支持多种部署方式,均通过 `file` 参数指定 `
- `module_name` 部分作为模块路径,用于通过 `importlib` 动态导入
- 若指定了 `package_name`,则整个路径需构成一个合法的 Python 导入路径,且 ZIP 包结构必须与该路径一致
+:::caution Warning
+命名空间应具备唯一性,避免与 Python 标准库或常用第三方库同名,以避免因模块遮蔽导致的依赖冲突及运行时异常
+:::
+
**示例说明**:
**示例 A: 无包结构(两段式)**
@@ -1286,6 +1290,10 @@ zip stats_udaf.zip stats_udaf.py
- 如果得到**两个**子字符串,分别为 `module_name` 和 `ClassName`
- 如果得到**三个及以上**的子字符串,开头为 `package_name`,中间为 `module_name`,结尾为 `ClassName`
+:::caution Warning
+命名空间应具备唯一性,避免与 Python 标准库或常用第三方库同名,以避免因模块遮蔽导致的依赖冲突及运行时异常
+:::
+
**步骤 5: 创建 UDAF 函数**
```sql
@@ -2229,6 +2237,10 @@ zip text_udtf.zip text_udtf.py
- 如果得到**两个**子字符串,分别为 `module_name` 和 `function_name`
- 如果得到**三个及以上**的子字符串,开头为 `package_name`,中间为 `module_name`,结尾为 `function_name`
+:::caution Warning
+命名空间应具备唯一性,避免与 Python 标准库或常用第三方库同名,以避免因模块遮蔽导致的依赖冲突及运行时异常
+:::
+
**步骤 5: 创建 UDTF 函数**
```sql
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-outer.md
new file mode 100644
index 00000000000..54ab715471c
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-outer.md
@@ -0,0 +1,95 @@
+---
+{
+ "title": "JSON_EACH_OUTER",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 JSON 类型值。与 json_each
的区别在于:当输入为 NULL 或空对象时,返回一行 NULL 值而非 0 行。需配合 LATERAL VIEW 使用。"
+}
+---
+
+## 描述
+
+`json_each_outer` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。其中
`value` 列保持 JSON 类型,字符串值在输出中保留 JSON 引号。
+
+与 [`json_each`](json-each.md) 的区别在于:当输入为 NULL 或空对象时,`json_each_outer` 返回一行
`NULL, NULL`,而 `json_each` 返回 0 行。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+:::note
+该函数自4.1.0起支持
+:::
+
+## 语法
+
+```sql
+JSON_EACH_OUTER(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ------ | ------------------------------------------------------ |
+| `key` | String | JSON 对象的键名 |
+| `value` | JSON | 对应的值,保持 JSON 类型(字符串值带引号,如 `"foo"`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 1 行 `NULL, NULL`
+- 如果 `<json_str>` 为空对象(`{}`),返回 1 行 `NULL, NULL`
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+NULL 参数:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+空对象:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-text-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-text-outer.md
new file mode 100644
index 00000000000..5b58f8d9969
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-text-outer.md
@@ -0,0 +1,98 @@
+---
+{
+ "title": "JSON_EACH_TEXT_OUTER",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 TEXT 类型值。与 json_each_text
的区别在于:当输入为 NULL 或空对象时,返回一行 NULL 值而非 0 行。需配合 LATERAL VIEW 使用。"
+}
+---
+
+## 描述
+
+`json_each_text_outer` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。与
[`json_each_outer`](json-each-outer.md) 不同,`value` 列的类型为 TEXT,字符串值在输出中**不保留**
JSON 引号。
+
+与 [`json_each_text`](json-each-text.md) 的区别在于:当输入为 NULL
或空对象时,`json_each_text_outer` 返回一行 `NULL, NULL`,而 `json_each_text` 返回 0 行。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+:::note
+该函数自4.1.0起支持
+:::
+
+## 语法
+
+```sql
+JSON_EACH_TEXT_OUTER(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ---- | ------------------------------------------------------ |
+| `key` | TEXT | JSON 对象的键名 |
+| `value` | TEXT | 对应的值,以文本形式返回(字符串值不带引号,如 `foo`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 1 行 `NULL, NULL`
+- 如果 `<json_str>` 为空对象(`{}`),返回 1 行 `NULL, NULL`
+- JSON 值为 `null` 时,对应的 TEXT 值为 SQL `NULL`
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> `value` 列类型为 TEXT,字符串值**不保留** JSON 引号(与 `json_each_outer` 的区别)。
+
+NULL 参数:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+空对象:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-text.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-text.md
new file mode 100644
index 00000000000..baac991f3bf
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each-text.md
@@ -0,0 +1,103 @@
+---
+{
+ "title": "JSON_EACH_TEXT",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 TEXT 类型值。需配合 LATERAL VIEW
使用。"
+}
+---
+
+## 描述
+
+`json_each_text` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。与
[`json_each`](json-each.md) 不同,`value` 列的类型为 TEXT,字符串值在输出中**不保留** JSON 引号。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+:::note
+该函数自4.1.0起支持
+:::
+
+## 语法
+
+```sql
+JSON_EACH_TEXT(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ---- | ------------------------------------------------------ |
+| `key` | TEXT | JSON 对象的键名 |
+| `value` | TEXT | 对应的值,以文本形式返回(字符串值不带引号,如 `foo`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 0 行
+- 如果 `<json_str>` 为空对象(`{}`),返回 0 行
+- JSON 值为 `null` 时,对应的 TEXT 值为 SQL `NULL`
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> `value` 列类型为 TEXT,字符串值**不保留** JSON 引号(与 `json_each` 的区别)。
+
+包含多种类型值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each_text('{"str":"hello","num":42,"bool":true,"null_val":null}') t AS k,
v;
+```
+
+```text
++----------+-------+
+| k | v |
++----------+-------+
+| str | hello |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
++----------+-------+
+```
+
+> JSON 中的 `null` 值对应 SQL `NULL`。
+
+NULL 参数:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text(NULL) t AS k, v;
+-- Empty set
+```
+
+空对象:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{}') t AS k, v;
+-- Empty set
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each.md
new file mode 100644
index 00000000000..aeb27056ba2
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/table-functions/json-each.md
@@ -0,0 +1,100 @@
+---
+{
+ "title": "JSON_EACH",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 JSON 类型值。需配合 LATERAL VIEW
使用。"
+}
+---
+
+## 描述
+
+`json_each` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。其中 `value` 列保持
JSON 类型,字符串值在输出中保留 JSON 引号。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+:::note
+该函数自4.1.0起支持
+:::
+
+## 语法
+
+```sql
+JSON_EACH(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ------ | ------------------------------------------------------ |
+| `key` | String | JSON 对象的键名 |
+| `value` | JSON | 对应的值,保持 JSON 类型(字符串值带引号,如 `"foo"`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 0 行
+- 如果 `<json_str>` 为空对象(`{}`),返回 0 行
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+> `value` 列类型为 JSON,字符串值保留 JSON 引号。
+
+包含多种类型值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each('{"str":"hello","num":42,"bool":true,"null_val":null,"arr":[1,2]}') t
AS k, v;
+```
+
+```text
++----------+---------+
+| k | v |
++----------+---------+
+| str | "hello" |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
+| arr | [1,2] |
++----------+---------+
+```
+
+NULL 参数:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each(NULL) t AS k, v;
+-- Empty set
+```
+空对象:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{}') t AS k, v;
+-- Empty set
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-outer.md
new file mode 100644
index 00000000000..5b10c0e831c
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-outer.md
@@ -0,0 +1,91 @@
+---
+{
+ "title": "JSON_EACH_OUTER",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 JSON 类型值。与 json_each
的区别在于:当输入为 NULL 或空对象时,返回一行 NULL 值而非 0 行。需配合 LATERAL VIEW 使用。"
+}
+---
+
+## 描述
+
+`json_each_outer` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。其中
`value` 列保持 JSON 类型,字符串值在输出中保留 JSON 引号。
+
+与 [`json_each`](json-each.md) 的区别在于:当输入为 NULL 或空对象时,`json_each_outer` 返回一行
`NULL, NULL`,而 `json_each` 返回 0 行。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+## 语法
+
+```sql
+JSON_EACH_OUTER(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ------ | ------------------------------------------------------ |
+| `key` | String | JSON 对象的键名 |
+| `value` | JSON | 对应的值,保持 JSON 类型(字符串值带引号,如 `"foo"`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 1 行 `NULL, NULL`
+- 如果 `<json_str>` 为空对象(`{}`),返回 1 行 `NULL, NULL`
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+NULL 参数:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+空对象:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text-outer.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text-outer.md
new file mode 100644
index 00000000000..2bc21a27fbb
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text-outer.md
@@ -0,0 +1,94 @@
+---
+{
+ "title": "JSON_EACH_TEXT_OUTER",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 TEXT 类型值。与 json_each_text
的区别在于:当输入为 NULL 或空对象时,返回一行 NULL 值而非 0 行。需配合 LATERAL VIEW 使用。"
+}
+---
+
+## 描述
+
+`json_each_text_outer` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。与
[`json_each_outer`](json-each-outer.md) 不同,`value` 列的类型为 TEXT,字符串值在输出中**不保留**
JSON 引号。
+
+与 [`json_each_text`](json-each-text.md) 的区别在于:当输入为 NULL
或空对象时,`json_each_text_outer` 返回一行 `NULL, NULL`,而 `json_each_text` 返回 0 行。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+## 语法
+
+```sql
+JSON_EACH_TEXT_OUTER(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ---- | ------------------------------------------------------ |
+| `key` | TEXT | JSON 对象的键名 |
+| `value` | TEXT | 对应的值,以文本形式返回(字符串值不带引号,如 `foo`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 1 行 `NULL, NULL`
+- 如果 `<json_str>` 为空对象(`{}`),返回 1 行 `NULL, NULL`
+- JSON 值为 `null` 时,对应的 TEXT 值为 SQL `NULL`
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> `value` 列类型为 TEXT,字符串值**不保留** JSON 引号(与 `json_each_outer` 的区别)。
+
+NULL 参数:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+空对象:返回 1 行 NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text.md
new file mode 100644
index 00000000000..a584a17d122
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text.md
@@ -0,0 +1,103 @@
+---
+{
+ "title": "JSON_EACH_TEXT",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 TEXT 类型值。需配合 LATERAL VIEW
使用。"
+}
+---
+
+## 描述
+
+`json_each_text` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。与
[`json_each`](json-each.md) 不同,`value` 列的类型为 TEXT,字符串值在输出中**不保留** JSON 引号。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+:::note
+该函数自4.1.0开始支持
+:::
+
+## 语法
+
+```sql
+JSON_EACH_TEXT(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ---- | ------------------------------------------------------ |
+| `key` | TEXT | JSON 对象的键名 |
+| `value` | TEXT | 对应的值,以文本形式返回(字符串值不带引号,如 `foo`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 0 行
+- 如果 `<json_str>` 为空对象(`{}`),返回 0 行
+- JSON 值为 `null` 时,对应的 TEXT 值为 SQL `NULL`
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> `value` 列类型为 TEXT,字符串值**不保留** JSON 引号(与 `json_each` 的区别)。
+
+包含多种类型值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each_text('{"str":"hello","num":42,"bool":true,"null_val":null}') t AS k,
v;
+```
+
+```text
++----------+-------+
+| k | v |
++----------+-------+
+| str | hello |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
++----------+-------+
+```
+
+> JSON 中的 `null` 值对应 SQL `NULL`。
+
+NULL 参数:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text(NULL) t AS k, v;
+-- Empty set
+```
+
+空对象:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{}') t AS k, v;
+-- Empty set
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each.md
new file mode 100644
index 00000000000..be54303963d
--- /dev/null
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/table-functions/json-each.md
@@ -0,0 +1,101 @@
+---
+{
+ "title": "JSON_EACH",
+ "language": "zh-CN",
+ "description": "将顶层 JSON 对象展开为键值对集合,每行包含一个键和对应的 JSON 类型值。需配合 LATERAL VIEW
使用。"
+}
+---
+
+## 描述
+
+`json_each` 表函数将顶层 JSON 对象展开为一组键值对,每行包含一个键(`key`)和对应的值(`value`)。其中 `value` 列保持
JSON 类型,字符串值在输出中保留 JSON 引号。
+
+该函数需配合 [`LATERAL VIEW`](../../../query-data/lateral-view.md) 使用。
+
+:::note
+该函数自4.1.0开始支持
+:::
+
+## 语法
+
+```sql
+JSON_EACH(<json_str>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------ | -------------------------------------------- |
+| `<json_str>` | 需要展开的 JSON 字符串,内容应为 JSON 对象。 |
+
+## 返回值
+
+返回多列多行数据,每行对应 JSON 对象中的一个键值对:
+
+| 列名 | 类型 | 说明 |
+| ------- | ------ | ------------------------------------------------------ |
+| `key` | String | JSON 对象的键名 |
+| `value` | JSON | 对应的值,保持 JSON 类型(字符串值带引号,如 `"foo"`) |
+
+特殊情况:
+- 如果 `<json_str>` 为 NULL,返回 0 行
+- 如果 `<json_str>` 为空对象(`{}`),返回 0 行
+
+## 示例
+
+基本用法:展开包含字符串值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+> `value` 列类型为 JSON,字符串值保留 JSON 引号。
+
+包含多种类型值的 JSON 对象
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each('{"str":"hello","num":42,"bool":true,"null_val":null,"arr":[1,2]}') t
AS k, v;
+```
+
+```text
++----------+---------+
+| k | v |
++----------+---------+
+| str | "hello" |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
+| arr | [1,2] |
++----------+---------+
+```
+
+NULL 参数:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each(NULL) t AS k, v;
+-- Empty set
+```
+
+空对象:返回 0 行
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{}') t AS k, v;
+-- Empty set
+```
diff --git a/sidebars.ts b/sidebars.ts
index 99a8026140a..bc3abd1a22e 100644
--- a/sidebars.ts
+++ b/sidebars.ts
@@ -2095,6 +2095,10 @@ const sidebars: SidebarsConfig = {
'sql-manual/sql-functions/table-functions/explode-numbers-outer',
'sql-manual/sql-functions/table-functions/explode-split',
'sql-manual/sql-functions/table-functions/explode-split-outer',
+
'sql-manual/sql-functions/table-functions/json-each',
+
'sql-manual/sql-functions/table-functions/json-each-outer',
+
'sql-manual/sql-functions/table-functions/json-each-text',
+
'sql-manual/sql-functions/table-functions/json-each-text-outer',
'sql-manual/sql-functions/table-functions/posexplode',
'sql-manual/sql-functions/table-functions/posexplode-outer',
],
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-outer.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-outer.md
new file mode 100644
index 00000000000..3d7679efa6f
--- /dev/null
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-outer.md
@@ -0,0 +1,95 @@
+---
+{
+ "title": "JSON_EACH_OUTER",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column retains JSON type. Unlike json_each, returns one
row of NULLs instead of 0 rows when input is NULL or an empty object. Must be
used with LATERAL VIEW."
+}
+---
+
+## Description
+
+The `json_each_outer` table function expands the top-level JSON object into a
set of key/value pairs. Each row contains one key (`key`) and its corresponding
value (`value`). The `value` column retains the JSON type, so string values are
returned with JSON quotes preserved.
+
+Unlike [`json_each`](json-each.md), when the input is NULL or an empty object,
`json_each_outer` returns one row of `NULL, NULL` instead of 0 rows.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+:::note
+Since 4.1.0
+:::
+
+## Syntax
+
+```sql
+JSON_EACH_OUTER(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+| ------------ | -------------------------------------------------------------
|
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+| ------- | ------ |
---------------------------------------------------------------------------------------
|
+| `key` | String | The key name from the JSON object
|
+| `value` | JSON | The corresponding value, kept as JSON type (string values
include quotes, e.g. `"foo"`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 1 row of `NULL, NULL`
+- If `<json_str>` is an empty object (`{}`), returns 1 row of `NULL, NULL`
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+NULL parameter: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+Empty object: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text-outer.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text-outer.md
new file mode 100644
index 00000000000..4a39947615b
--- /dev/null
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text-outer.md
@@ -0,0 +1,98 @@
+---
+{
+ "title": "JSON_EACH_TEXT_OUTER",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column is returned as plain text. Unlike json_each_text,
returns one row of NULLs instead of 0 rows when input is NULL or an empty
object. Must be used with LATERAL VIEW."
+}
+---
+
+## Description
+
+The `json_each_text_outer` table function expands the top-level JSON object
into a set of key/value pairs. Each row contains one key (`key`) and its
corresponding value (`value`). Unlike [`json_each_outer`](json-each-outer.md),
the `value` column is of type TEXT, so string values are returned **without**
JSON quotes.
+
+Unlike [`json_each_text`](json-each-text.md), when the input is NULL or an
empty object, `json_each_text_outer` returns one row of `NULL, NULL` instead of
0 rows.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+:::note
+Since 4.1.0
+:::
+
+## Syntax
+
+```sql
+JSON_EACH_TEXT_OUTER(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+| ------------ | -------------------------------------------------------------
|
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+| ------- | ---- |
--------------------------------------------------------------------------------
|
+| `key` | TEXT | The key name from the JSON object
|
+| `value` | TEXT | The corresponding value as plain text (string values have
no quotes, e.g. `foo`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 1 row of `NULL, NULL`
+- If `<json_str>` is an empty object (`{}`), returns 1 row of `NULL, NULL`
+- A JSON `null` value is returned as SQL `NULL`
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> The `value` column is of TEXT type, so string values have **no** JSON quotes
(unlike `json_each_outer`).
+
+NULL parameter: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer(NULL) t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
+Empty object: returns 1 row of NULL
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text_outer('{}') t AS k, v;
+```
+
+```text
++------+------+
+| k | v |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text.md
new file mode 100644
index 00000000000..1be2b7f2f7b
--- /dev/null
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each-text.md
@@ -0,0 +1,103 @@
+---
+{
+ "title": "JSON_EACH_TEXT",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column is returned as plain text. Must be used with
LATERAL VIEW."
+}
+---
+
+## Description
+
+The `json_each_text` table function expands the top-level JSON object into a
set of key/value pairs. Each row contains one key (`key`) and its corresponding
value (`value`). Unlike [`json_each`](json-each.md), the `value` column is of
type TEXT, so string values are returned **without** JSON quotes.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+:::note
+Since 4.1.0
+:::
+
+## Syntax
+
+```sql
+JSON_EACH_TEXT(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ------------ | ---------------------------------------------------- |
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+|---------|------|--------------------------------------------------------------------------------------|
+| `key` | TEXT | The key name from the JSON object
|
+| `value` | TEXT | The corresponding value as plain text (string values have
no quotes, e.g. `foo`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 0 rows
+- If `<json_str>` is an empty object (`{}`), returns 0 rows
+- A JSON `null` value is returned as SQL `NULL`
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-----+
+| k | v |
++---+-----+
+| a | foo |
+| b | bar |
++---+-----+
+```
+
+> The `value` column is of TEXT type, so string values have **no** JSON quotes
(unlike `json_each`).
+
+JSON object with multiple value types
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each_text('{"str":"hello","num":42,"bool":true,"null_val":null}') t AS k,
v;
+```
+
+```text
++----------+-------+
+| k | v |
++----------+-------+
+| str | hello |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
++----------+-------+
+```
+
+> JSON `null` values map to SQL `NULL`.
+
+NULL parameter: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text(NULL) t AS k, v;
+-- Empty set
+```
+
+Empty object: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each_text('{}') t AS k, v;
+-- Empty set
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each.md
new file mode 100644
index 00000000000..00f37312da6
--- /dev/null
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/table-functions/json-each.md
@@ -0,0 +1,101 @@
+---
+{
+ "title": "JSON_EACH",
+ "language": "en",
+ "description": "Expands the top-level JSON object into a set of key/value
pairs, where the value column retains JSON type. Must be used with LATERAL
VIEW."
+}
+---
+
+## Description
+
+The `json_each` table function expands the top-level JSON object into a set of
key/value pairs. Each row contains one key (`key`) and its corresponding value
(`value`). The `value` column retains the JSON type, so string values are
returned with JSON quotes preserved.
+
+Must be used with [`LATERAL VIEW`](../../../query-data/lateral-view.md).
+
+:::note
+Since 4.1.0
+:::
+
+## Syntax
+
+```sql
+JSON_EACH(<json_str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| ------------ | ---------------------------------------------------- |
+| `<json_str>` | The JSON string to expand. The content must be a JSON object.
|
+
+## Return Value
+
+Returns multi-column, multi-row data. Each row corresponds to one key-value
pair in the JSON object:
+
+| Column | Type | Description
|
+|---------|--------|-----------------------------------------------------------------------------|
+| `key` | String | The key name from the JSON object
|
+| `value` | JSON | The corresponding value, kept as JSON type (string values
include quotes, e.g. `"foo"`) |
+
+Special cases:
+- If `<json_str>` is NULL, returns 0 rows
+- If `<json_str>` is an empty object (`{}`), returns 0 rows
+
+## Examples
+
+Basic usage: expand a JSON object with string values
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{"a":"foo","b":"bar"}') t AS k, v;
+```
+
+```text
++---+-------+
+| k | v |
++---+-------+
+| a | "foo" |
+| b | "bar" |
++---+-------+
+```
+
+> The `value` column is of JSON type, so string values retain their JSON
quotes.
+
+JSON object with multiple value types
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW
json_each('{"str":"hello","num":42,"bool":true,"null_val":null,"arr":[1,2]}') t
AS k, v;
+```
+
+```text
++----------+---------+
+| k | v |
++----------+---------+
+| str | "hello" |
+| num | 42 |
+| bool | true |
+| null_val | NULL |
+| arr | [1,2] |
++----------+---------+
+```
+
+NULL parameter: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each(NULL) t AS k, v;
+-- Empty set
+```
+
+Empty object: returns 0 rows
+
+```sql
+SELECT k, v
+FROM (SELECT 1) dummy
+LATERAL VIEW json_each('{}') t AS k, v;
+-- Empty set
+```
diff --git a/versioned_sidebars/version-4.x-sidebars.json
b/versioned_sidebars/version-4.x-sidebars.json
index 51eda5d33ed..7f0db07a843 100644
--- a/versioned_sidebars/version-4.x-sidebars.json
+++ b/versioned_sidebars/version-4.x-sidebars.json
@@ -2110,6 +2110,10 @@
"sql-manual/sql-functions/table-functions/explode-numbers-outer",
"sql-manual/sql-functions/table-functions/explode-split",
"sql-manual/sql-functions/table-functions/explode-split-outer",
+
"sql-manual/sql-functions/table-functions/json-each",
+
"sql-manual/sql-functions/table-functions/json-each-outer",
+
"sql-manual/sql-functions/table-functions/json-each-text",
+
"sql-manual/sql-functions/table-functions/json-each-text-outer",
"sql-manual/sql-functions/table-functions/posexplode",
"sql-manual/sql-functions/table-functions/posexplode-outer"
]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]