This is an automated email from the ASF dual-hosted git repository.
mrhhsg 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 7cce72f37d3 fix some docs about json (#2789)
7cce72f37d3 is described below
commit 7cce72f37d311054fea2842244823e7abc34e7ed
Author: Jerry Hu <[email protected]>
AuthorDate: Tue Aug 26 10:57:10 2025 +0800
fix some docs about json (#2789)
## Versions
- [x] dev
- [ ] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../scalar-functions/json-functions/json-search.md | 42 +++++++++++++++++++---
.../scalar-functions/json-functions/json-type.md | 3 --
.../scalar-functions/json-functions/to-json.md | 2 +-
.../scalar-functions/json-functions/json-search.md | 42 +++++++++++++++++++---
.../scalar-functions/json-functions/json-type.md | 5 +--
.../scalar-functions/json-functions/to-json.md | 2 +-
6 files changed, 79 insertions(+), 17 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
index 2fe68beba05..3af76de161e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
@@ -18,6 +18,7 @@ JSON_SEARCH( <json_object>, <one_or_all>, <search_value> )
- `<json_object>`: JSON type, the JSON document to be searched.
- `<one_or_all>`: String type, specifies whether to find all matching values.
Can be 'one' or 'all'.
- `<search_value>`: String type, the value to search for, the search target.
+ Supports '%' (matches any number of any characters) and '_' (matches any
single character) as wildcards.
## Return Value
Nullable(JSON): Depending on the `<one_or_all>` parameter, there are two cases:
@@ -66,7 +67,41 @@ Nullable(JSON): Depending on the `<one_or_all>` parameter,
there are two cases:
| ["$.alias","$.name"]
|
+----------------------------------------------------------------------------+
```
-4. No matching value found
+4. '%' as a wildcard
+ ```sql
+ SELECT JSON_SEARCH('{"name": "John", "age": 30, "alias": "John"}', 'all',
'%');
+ ```
+ ```text
+ +-------------------------------------------------------------------------+
+ | JSON_SEARCH('{"name": "John", "age": 30, "alias": "John"}', 'all', '%') |
+ +-------------------------------------------------------------------------+
+ | ["$.alias","$.name"] |
+ +-------------------------------------------------------------------------+
+ ```
+5. '_' as a wildcard
+ ```sql
+ SELECT JSON_SEARCH('{"name": "John", "age": 30, "alias": "Jihn"}', 'all',
'J_hn');
+ ```
+ ```text
+
+----------------------------------------------------------------------------+
+ | JSON_SEARCH('{"name": "John", "age": 30, "alias": "Jihn"}', 'all',
'J_hn') |
+
+----------------------------------------------------------------------------+
+ | ["$.alias","$.name"]
|
+
+----------------------------------------------------------------------------+
+ ```
+6. Wildcard escape
+ ```sql
+ SELECT JSON_SEARCH('{"name": "John", "age": 30, "alias": "J_hn"}', 'all',
'J\_hn');
+ ```
+ ```text
+
+-----------------------------------------------------------------------------+
+ | JSON_SEARCH('{"name": "John", "age": 30, "alias": "J_hn"}', 'all',
'J\_hn') |
+
+-----------------------------------------------------------------------------+
+ | "$.alias"
|
+
+-----------------------------------------------------------------------------+
+ ```
+ > 'J\_hn' only matches "J_hn" and does not match "John".
+7. No matching value found
```sql
SELECT JSON_SEARCH('{"name": "John", "age": 30}', 'one', 'Alice');
@@ -78,8 +113,7 @@ Nullable(JSON): Depending on the `<one_or_all>` parameter,
there are two cases:
| NULL |
+------------------------------------------------------------+
```
-
-5. NULL parameters
+8. NULL parameters
```sql
SELECT JSON_SEARCH('{"name": "John", "age": 30}', NULL, 'Alice');
```
@@ -110,7 +144,7 @@ Nullable(JSON): Depending on the `<one_or_all>` parameter,
there are two cases:
| NULL |
+-----------------------------------+
```
-6. Invalid `<one_or_all>` parameter
+9. Invalid `<one_or_all>` parameter
```sql
SELECT JSON_SEARCH('{"name": "John", "age": 30}', 'three', 'Alice');
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
index 52ff4a9f884..15102df652c 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
@@ -25,9 +25,6 @@ Used to determine the type of the field specified by
`json_path` in the JSONB da
JSON_TYPE( <json>, <json_path> )
```
-## Alias
-- `JSONB_TYPE`
-
## Parameters
- `<json>` The JSON string to check the type of.
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
b/docs/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
index 5359d07c2e4..272dfbb6176 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
@@ -39,7 +39,7 @@ TO_JSON(value)
**value** - The value to be converted to JSONB type. The following Doris data
types are supported:
- Numeric types: TINYINT, SMALLINT, INT, BIGINT, LARGEINT, FLOAT, DOUBLE,
DECIMAL
- Boolean type: BOOLEAN
-- String type: STRING, VARCHAR
+- String type: STRING, VARCHAR, CHAR
- Complex types: ARRAY, STRUCT
Types not listed above (like DATE, DATETIME, etc.) are not supported directly
and must be first converted to supported types (typically STRING).
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
index 44152d9f75c..8122dffc5dd 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-search.md
@@ -17,7 +17,7 @@ JSON_SEARCH( <json_object>, <one_or_all>, <search_value> )
## 必选参数
- `<json_object>`: JSON 类型,需要搜索的 JSON 文档。
- `<one_or_all>`: String 类型,指定是否查找所有匹配的值。可以取值 'one' 或 'all'。
-- `<search_value>`: String 类型,需要查找的值,搜索目标。
+- `<search_value>`: String 类型,需要查找的值,搜索目标。支持 '%'(匹配任意个数的任意字符)和 '_'(匹配任意单个字符)
作为通配符。
## 返回值
`Nullable(JSON)`: 根据参数 `<one_or_all>` 不同有两种情况:
@@ -66,7 +66,41 @@ JSON_SEARCH( <json_object>, <one_or_all>, <search_value> )
| ["$.alias","$.name"]
|
+----------------------------------------------------------------------------+
```
-4. 没有找到匹配值
+4. '%' 作为通配符
+ ```sql
+ SELECT JSON_SEARCH('{"name": "John", "age": 30, "alias": "John"}', 'all',
'%');
+ ```
+ ```text
+ +-------------------------------------------------------------------------+
+ | JSON_SEARCH('{"name": "John", "age": 30, "alias": "John"}', 'all', '%') |
+ +-------------------------------------------------------------------------+
+ | ["$.alias","$.name"] |
+ +-------------------------------------------------------------------------+
+ ```
+5. '_' 作为通配符
+ ```sql
+ SELECT JSON_SEARCH('{"name": "John", "age": 30, "alias": "Jihn"}', 'all',
'J_hn');
+ ```
+ ```text
+
+----------------------------------------------------------------------------+
+ | JSON_SEARCH('{"name": "John", "age": 30, "alias": "Jihn"}', 'all',
'J_hn') |
+
+----------------------------------------------------------------------------+
+ | ["$.alias","$.name"]
|
+
+----------------------------------------------------------------------------+
+ ```
+6. 通配符转义
+ ```sql
+ SELECT JSON_SEARCH('{"name": "John", "age": 30, "alias": "J_hn"}', 'all',
'J\_hn');
+ ```
+ ```text
+
+-----------------------------------------------------------------------------+
+ | JSON_SEARCH('{"name": "John", "age": 30, "alias": "J_hn"}', 'all',
'J\_hn') |
+
+-----------------------------------------------------------------------------+
+ | "$.alias"
|
+
+-----------------------------------------------------------------------------+
+ ```
+ > 'J\_hn' 只匹配了 "J_hn" 而没有匹配 "John"。
+74. 没有找到匹配值
```sql
SELECT JSON_SEARCH('{"name": "John", "age": 30}', 'one', 'Alice');
@@ -79,7 +113,7 @@ JSON_SEARCH( <json_object>, <one_or_all>, <search_value> )
+------------------------------------------------------------+
```
-5. NULL 参数
+8. NULL 参数
```sql
SELECT JSON_SEARCH('{"name": "John", "age": 30}', NULL, 'Alice');
```
@@ -110,7 +144,7 @@ JSON_SEARCH( <json_object>, <one_or_all>, <search_value> )
| NULL |
+-----------------------------------+
```
-6. 非法的 `<one_or_all>` 参数
+9. 非法的 `<one_or_all>` 参数
```sql
SELECT JSON_SEARCH('{"name": "John", "age": 30}', 'three', 'Alice');
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
index 5191d932602..30f31a7686d 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
@@ -22,9 +22,6 @@
JSON_TYPE(<json_object>, <json_path>)
```
-## 别名
-- `JSONB_TYPE`
-
## 参数
- `<json_object>`: [JSON
类型](../../../basic-element/sql-data-types/semi-structured/JSON.md) 的表达式。
- `<json_path>`: String 类型,比如 `"$.key"`。
@@ -35,7 +32,7 @@ JSON_TYPE(<json_object>, <json_path>)
## 使用说明
- 如果 `<json_object>` 或者 `<json_path>` 是 NULL,返回 NULL。
- 如果 `<json_path>` 不是一个合法路径,函数报错。
-- 如果 `<json_path>` 指定的字段,返回 NULL。
+- 如果 `<json_path>` 指定的字段不存在,返回 NULL。
## 示例
1. Double 类型
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
index d3c718e156f..e9682b99140 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/to-json.md
@@ -39,7 +39,7 @@ TO_JSON(value)
**value** - 要转换为 JSONB 类型的值。支持以下 Doris 数据类型:
- 数字类型:TINYINT、SMALLINT、INT、BIGINT、LARGEINT、FLOAT、DOUBLE、DECIMAL
- 布尔类型:BOOLEAN
-- 字符串类型:STRING、VARCHAR
+- 字符串类型:STRING、VARCHAR、CHAR
- 复杂类型:ARRAY、STRUCT
未列出的类型(如 DATE、DATETIME 等)不直接支持,必须先转换为支持的类型(通常是 STRING)。
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]