This is an automated email from the ASF dual-hosted git repository.
morningman 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 29fe7f4ba0c [fix](doc) json-type.md: replace stale jsonb_type headers,
fix zh fences, mirror examples (#3796)
29fe7f4ba0c is described below
commit 29fe7f4ba0c2cbc54b94c965e1b105046265a078
Author: boluor <[email protected]>
AuthorDate: Wed May 27 21:53:04 2026 -0700
[fix](doc) json-type.md: replace stale jsonb_type headers, fix zh fences,
mirror examples (#3796)
## Summary
Doc page (4.x): \`scalar-functions/json-functions/json-type.md\` (EN +
ZH).
Three problems addressed:
1. **EN — stale internal column header.** Result blocks for the first
two examples show the column header as
\`jsonb_type(cast('{\"name\":...}' as JSON), '$.name')\`. On Apache
Doris 4.1.1 the cluster returns the column header as the SQL itself,
preserving case — \`JSON_TYPE('{\"name\":...}', '$.name')\`.
\`jsonb_type\` was the internal name in the early JSONB era; current
versions print \`JSON_TYPE\`. Replaced with what the cluster prints
today.
2. **ZH — bare code fences on result blocks.** All six result blocks
were fenced with \`\`\`\`\`\`\`\` instead of \`\`\`\`text\`\`\`\`, so
docusaurus had no language hint and rendered the ASCII grid with no
syntax-highlighting tag.
3. **Each side had two type-coverage examples the other didn't.** EN had
\`string\` and \`int\`; ZH had \`double\` and \`bool\`. Mirrored them so
both pages now cover all four primitive types in the same order,
followed by the same NULL / missing-path / invalid-path examples.
## Verification
All 8 examples were run against a single-node Apache Doris 4.1.1 cluster
— the result blocks in this PR are the verbatim mysql client output.
## Test plan
- [x] Run each of the 8 SQL examples on a 4.1.1 cluster — each result
block matches.
- [x] EN and ZH now have the same 8 examples in the same order.
- [x] All result blocks tagged \`text\`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
---
.../scalar-functions/json-functions/json-type.md | 53 +++++++++++++++++-----
.../scalar-functions/json-functions/json-type.md | 53 ++++++++++++++++------
2 files changed, 80 insertions(+), 26 deletions(-)
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
index dac286b8d4a..ffd157663ee 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
@@ -36,65 +36,94 @@ JSON_TYPE(<json_object>, <json_path>)
- 如果 `<json_path>` 指定的字段不存在,返回 NULL。
## 示例
-1. Double 类型
+1. string 类型
```sql
- select json_type('{"key1": 1234.44}', '$.key1');
+ SELECT JSON_TYPE('{"name": "John", "age": 30}', '$.name');
+ ```
+ ```text
+ +----------------------------------------------------+
+ | JSON_TYPE('{"name": "John", "age": 30}', '$.name') |
+ +----------------------------------------------------+
+ | string |
+ +----------------------------------------------------+
+ ```
+
+2. int 类型
+ ```sql
+ SELECT JSON_TYPE('{"name": "John", "age": 30}', '$.age');
```
+ ```text
+ +---------------------------------------------------+
+ | JSON_TYPE('{"name": "John", "age": 30}', '$.age') |
+ +---------------------------------------------------+
+ | int |
+ +---------------------------------------------------+
```
+
+3. double 类型
+ ```sql
+ select json_type('{"key1": 1234.44}', '$.key1');
+ ```
+ ```text
+------------------------------------------+
| json_type('{"key1": 1234.44}', '$.key1') |
+------------------------------------------+
| double |
+------------------------------------------+
```
-2. BOOLEAN 类型
+
+4. bool 类型
```sql
select json_type('{"key1": true}', '$.key1');
```
- ```
+ ```text
+---------------------------------------+
| json_type('{"key1": true}', '$.key1') |
+---------------------------------------+
| bool |
+---------------------------------------+
```
-3. NULL 参数
+
+5. NULL 参数
```sql
select json_type(NULL, '$.key1');
```
- ```
+ ```text
+---------------------------+
| json_type(NULL, '$.key1') |
+---------------------------+
| NULL |
+---------------------------+
```
-4. NULL 参数 2
+
+6. NULL 参数 2
```sql
select json_type('{"key1": true}', NULL);
```
- ```
+ ```text
+-----------------------------------+
| json_type('{"key1": true}', NULL) |
+-----------------------------------+
| NULL |
+-----------------------------------+
```
-5. `json_path` 参数指定的字段不存在
+
+7. `json_path` 参数指定的字段不存在
```sql
select json_type('{"key1": true}', '$.key2');
```
- ```
+ ```text
+---------------------------------------+
| json_type('{"key1": true}', '$.key2') |
+---------------------------------------+
| NULL |
+---------------------------------------+
```
-6. 错误的 `json_path` 参数
+
+8. 错误的 `json_path` 参数
```sql
select json_type('{"key1": true}', '$.');
```
- ```
+ ```text
ERROR 1105 (HY000): errCode = 2, detailMessage = [INVALID_ARGUMENT]Json
path error: Invalid Json Path for value: $.
```
\ No newline at end of file
diff --git
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
index fefec11b4ba..aa9e6eacbca 100644
---
a/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
+++
b/versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/json-functions/json-type.md
@@ -46,11 +46,11 @@ JSON_TYPE( <json>, <json_path> )
SELECT JSON_TYPE('{"name": "John", "age": 30}', '$.name');
```
```text
- +-------------------------------------------------------------------+
- | jsonb_type(cast('{"name": "John", "age": 30}' as JSON), '$.name') |
- +-------------------------------------------------------------------+
- | string |
- +-------------------------------------------------------------------+
+ +----------------------------------------------------+
+ | JSON_TYPE('{"name": "John", "age": 30}', '$.name') |
+ +----------------------------------------------------+
+ | string |
+ +----------------------------------------------------+
```
2. JSON is of number type:
@@ -58,13 +58,38 @@ JSON_TYPE( <json>, <json_path> )
SELECT JSON_TYPE('{"name": "John", "age": 30}', '$.age');
```
```text
- +------------------------------------------------------------------+
- | jsonb_type(cast('{"name": "John", "age": 30}' as JSON), '$.age') |
- +------------------------------------------------------------------+
- | int |
- +------------------------------------------------------------------+
+ +---------------------------------------------------+
+ | JSON_TYPE('{"name": "John", "age": 30}', '$.age') |
+ +---------------------------------------------------+
+ | int |
+ +---------------------------------------------------+
```
-3. NULL parameters
+
+3. JSON is of double type:
+ ```sql
+ select json_type('{"key1": 1234.44}', '$.key1');
+ ```
+ ```text
+ +------------------------------------------+
+ | json_type('{"key1": 1234.44}', '$.key1') |
+ +------------------------------------------+
+ | double |
+ +------------------------------------------+
+ ```
+
+4. JSON is of bool type:
+ ```sql
+ select json_type('{"key1": true}', '$.key1');
+ ```
+ ```text
+ +---------------------------------------+
+ | json_type('{"key1": true}', '$.key1') |
+ +---------------------------------------+
+ | bool |
+ +---------------------------------------+
+ ```
+
+5. NULL parameters
```sql
select json_type(NULL, '$.key1');
```
@@ -75,7 +100,7 @@ JSON_TYPE( <json>, <json_path> )
| NULL |
+---------------------------+
```
-4. NULL parameters 2
+6. NULL parameters 2
```sql
select json_type('{"key1": true}', NULL);
```
@@ -86,7 +111,7 @@ JSON_TYPE( <json>, <json_path> )
| NULL |
+-----------------------------------+
```
-5. Field specified by `json_path` parameter does not exist
+7. Field specified by `json_path` parameter does not exist
```sql
select json_type('{"key1": true}', '$.key2');
```
@@ -97,7 +122,7 @@ JSON_TYPE( <json>, <json_path> )
| NULL |
+---------------------------------------+
```
-6. Invalid `json_path` parameter
+8. Invalid `json_path` parameter
```sql
select json_type('{"key1": true}', '$.');
```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]