Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opt](reference) update some json and string function docs #1891

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

cool-joker
Copy link

Versions

  • dev
  • 3.0
  • 2.1
  • 2.0

Languages

  • Chinese
  • English

Docs Checklist

  • Checked by AI
  • Test Cases Built

@KassieZ KassieZ requested a review from morrySnow January 21, 2025 10:06
@morrySnow morrySnow changed the title Shenxiaohu jira new [opt](reference) update json function docs Jan 21, 2025
@morrySnow morrySnow changed the title [opt](reference) update json function docs [opt](reference) update some json and string function docs Jan 21, 2025
Copy link
Contributor

@morrySnow morrySnow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只评论了dev 英文版。其他版本也对应修改一下


```sql

SET @j = '{"a": 1, "b": 2, "c": {"d": 4}}';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

例子中最好不要使用变量,前后的例子最好不要有依赖关系


```sql
STRING json_type(JSON j, VARCHAR json_path)
STRING JSON_TYPE( <JSON j> )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
STRING JSON_TYPE( <JSON j> )
STRING JSON_TYPE( <json> )


```sql
STRING json_type(JSON j, VARCHAR json_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json_path 被去掉了,是其实不支持?


| Parameter | Description |
|------|------|
| `<JSON j>` | The JSON string to check the type of. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `<JSON j>` | The JSON string to check the type of. |
| `<json>` | The JSON string to check the type of. |


`JSONB json_valid(VARCHAR json_str)`
```sql
JSONB JSON_VALID( <str> )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JSONB JSON_VALID( <str> )
JSON_VALID( <str> )


- upper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- upper
- UPPER

@KassieZ KassieZ requested a review from morrySnow January 22, 2025 06:24
@morrySnow morrySnow requested a review from KassieZ January 22, 2025 06:50
@@ -30,7 +30,9 @@ under the License.

## 语法

`JSON_LENGTH(JSON <json_str>, <json_path>)`
```sql
JSON_LENGTH(JSON <json_str> [ , <json_path>])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 参数不要带类型
Suggested change
JSON_LENGTH(JSON <json_str> [ , <json_path>])
JSON_LENGTH(<json_str> [ , <json_path>])

@@ -43,7 +43,7 @@ under the License.
## 语法

```sql
STRING JSON_TYPE( <JSON j> )
STRING JSON_TYPE( <JSON> )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 参数用小写
Suggested change
STRING JSON_TYPE( <JSON> )
STRING JSON_TYPE( <json> )

Copy link
Contributor

@morrySnow morrySnow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

几个共性问题,麻烦检查一下所有文档

  1. 语法中参数未用尖括号报错
  2. 部分文档缺少参数章节
  3. 示例中,查询和结果要放入两个 code block 中,查询使用 sql 格式,结果使用 text 格式

```sql
ALTER STORAGE POLICY 'policy_name'
PROPERTIES ("key"="value", ...);
ALTER STORAGE POLICY 'policy_name' PROPERTIES ("key"="value", ...);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 参数需要尖括号包裹
  2. 变长参数部分,应该用方括号包裹
Suggested change
ALTER STORAGE POLICY 'policy_name' PROPERTIES ("key"="value", ...);
ALTER STORAGE POLICY "<policy_name>" PROPERTIES ("<key>"="<value>" [, ... ]);

```sql
ALTER STORAGE POLICY 'policy_name'
PROPERTIES ("key"="value", ...);
ALTER STORAGE POLICY 'policy_name' PROPERTIES ("key"="value", ...);
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缺少参数描述部分

## 描述

该命令用于创建存储库。本文档的主题描述了创建 Doris 自管理存储库的语法。


## 语法

```sql
CREATE STORAGE VAULT [IF NOT EXISTS] vault
[properties]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[properties]
[ <properties> ]

```sql
CREATE STORAGE VAULT [IF NOT EXISTS] vault
[properties]
```

#### properties
## 参数

| 参数 | 是否必需 | 描述 |
|:-------|:-----|:-----------------------|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是参数 properties 的 key 的可选范围。
参数需要先写 <properties>,介绍 properties 的用处。
然后再介绍 properties 时,再用另外一个表格介绍 properties 的 key 都的可选范围。

@@ -34,8 +34,7 @@ under the License.
SET vault_name DEFAULT STORAGE VAULT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SET vault_name DEFAULT STORAGE VAULT
SET <vault_name> DEFAULT STORAGE VAULT

@@ -36,26 +36,20 @@ under the License.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

语法中的参数需要尖括号包裹

SHOW CACHE HOTSPOT '/[<compute_group_name>/<table_name>]';

Comment on lines +41 to +42
| compute_group_name | 计算组的名称。 |
| table_name | 表的名称。 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| compute_group_name | 计算组的名称。 |
| table_name | 表的名称。 |
| <compute_group_name> | 计算组的名称。 |
| <table_name> | 表的名称。 |

@@ -30,7 +30,7 @@ under the License.

查看所有/指定存储策略关联的表和分区

语法:
## 语法

```sql
SHOW STORAGE POLICY USING [FOR some_policy]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SHOW STORAGE POLICY USING [FOR some_policy]
SHOW STORAGE POLICY USING [FOR <some_policy>]

@@ -30,7 +30,7 @@ under the License.

查看所有/指定存储策略关联的表和分区

语法:
## 语法

```sql
SHOW STORAGE POLICY USING [FOR some_policy]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

缺少参数章节

@@ -40,7 +40,7 @@ SHOW STORAGE POLICY USING [FOR some_policy]

1. 查看所有启用了存储策略的对象
```sql
mysql> show storage policy using;
show storage policy using;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

查询和结果要放到两个 code block 中

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants