Skip to content

Commit 8e9e10f

Browse files
authored
improve wg and json (#2694)
* improve the COPY INTO table * improve wg and json * improve json index
1 parent 43757e7 commit 8e9e10f

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

docs/en/sql-reference/10-sql-commands/00-ddl/20-workload-group/create-workload-group.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ WITH cpu_quota = '70%', memory_quota = '80%', max_concurrency = 10;
4242
Users must be assigned to workload groups to enable resource limiting. When users execute queries, the system applies the workload group's restrictions automatically.
4343

4444
```sql
45-
-- Create and assign user
45+
-- Create user and grant permissions
4646
CREATE USER analytics_user IDENTIFIED BY 'password123';
47+
GRANT ALL ON *.* TO analytics_user;
48+
49+
-- Assign user to workload group
4750
ALTER USER analytics_user WITH SET WORKLOAD GROUP = 'interactive_queries';
4851

4952
-- Reassign to different workload group

docs/en/sql-reference/10-sql-commands/00-ddl/20-workload-group/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ Workload groups enable resource management and query concurrency control in Data
1616
-- Create workload group
1717
CREATE WORKLOAD GROUP analytics WITH cpu_quota = '50%', memory_quota = '30%', max_concurrency = 5;
1818

19-
-- Assign user to workload group
19+
-- Create user and grant permissions
2020
CREATE USER analyst IDENTIFIED BY 'password';
21+
GRANT ALL ON *.* TO analyst;
22+
23+
-- Assign user to workload group
2124
ALTER USER analyst WITH SET WORKLOAD GROUP = 'analytics';
25+
26+
-- Remove user from workload group (user will use default unlimited resources)
27+
ALTER USER analyst WITH UNSET WORKLOAD GROUP;
2228
```
2329

2430
## Command Reference

docs/en/sql-reference/20-sql-functions/10-semi-structured-functions/0-json/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ This section provides reference information for JSON functions in Databend. JSON
3737

3838
| Function | Description | Example |
3939
|----------|-------------|---------|
40+
| [GET](get) | Extracts value from JSON by index or field name | `GET('{"name":"John"}', 'name')``"John"` |
41+
| [GET_IGNORE_CASE](get-ignore-case) | Extracts value with case-insensitive field matching | `GET_IGNORE_CASE('{"Name":"John"}', 'name')``"John"` |
42+
| [GET_PATH](get-path) | Extracts value using path notation | `GET_PATH('{"user":{"name":"John"}}', 'user.name')``"John"` |
4043
| [JSON_EXTRACT_PATH_TEXT](json-extract-path-text) | Extracts text value from JSON using path | `JSON_EXTRACT_PATH_TEXT('{"name":"John"}', 'name')``'John'` |
4144
| [JSON_EACH](json-each) | Expands JSON object into key-value pairs | `JSON_EACH('{"a":1,"b":2}')``[("a",1),("b",2)]` |
4245
| [JSON_ARRAY_ELEMENTS](json-array-elements) | Expands JSON array into individual elements | `JSON_ARRAY_ELEMENTS('[1,2,3]')``1, 2, 3` |

docs/en/sql-reference/20-sql-functions/10-semi-structured-functions/index.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,44 @@ Structured and semi-structured functions in Databend enable efficient processing
66

77
## JSON Functions
88

9+
### Parsing & Validation
910
| Function | Description | Example |
1011
|----------|-------------|--------|
1112
| [PARSE_JSON](json/parse-json) | Parses a JSON string into a variant value | `PARSE_JSON('[1,2,3]')` |
1213
| [CHECK_JSON](json/check-json) | Validates if a string is valid JSON | `CHECK_JSON('{"a":1}')` |
1314
| [JSON_TYPEOF](json/json-typeof) | Returns the type of a JSON value | `JSON_TYPEOF(PARSE_JSON('[1,2,3]'))` |
14-
| [JSON_TO_STRING](json/json-to-string) | Converts a JSON value to a string | `JSON_TO_STRING(PARSE_JSON('{"a":1}'))` |
15+
16+
### Path-based Querying
17+
| Function | Description | Example |
18+
|----------|-------------|--------|
1519
| [JSON_PATH_EXISTS](json/json-path-exists) | Checks if a JSON path exists | `JSON_PATH_EXISTS(json_obj, '$.name')` |
16-
| [JSON_PATH_MATCH](json/json-path-match) | Matches JSON values against a path pattern | `JSON_PATH_MATCH(json_obj, '$.age')` |
1720
| [JSON_PATH_QUERY](json/json-path-query) | Queries JSON data using JSONPath | `JSON_PATH_QUERY(json_obj, '$.items[*]')` |
1821
| [JSON_PATH_QUERY_ARRAY](json/json-path-query-array) | Queries JSON data and returns results as an array | `JSON_PATH_QUERY_ARRAY(json_obj, '$.items')` |
1922
| [JSON_PATH_QUERY_FIRST](json/json-path-query-first) | Returns the first result from a JSON path query | `JSON_PATH_QUERY_FIRST(json_obj, '$.items[*]')` |
20-
| [JSON_EXTRACT_PATH_TEXT](json/json-extract-path-text) | Extracts text value from JSON using path | `JSON_EXTRACT_PATH_TEXT(json_obj, 'name')` |
23+
| [JSON_PATH_MATCH](json/json-path-match) | Matches JSON values against a path pattern | `JSON_PATH_MATCH(json_obj, '$.age')` |
24+
| [JQ](json/jq) | Advanced JSON processing using jq syntax | `JQ('.name', json_obj)` |
25+
26+
### Value Extraction
27+
| Function | Description | Example |
28+
|----------|-------------|--------|
2129
| [GET](json/get) | Gets a value from a JSON object by key or array by index | `GET(PARSE_JSON('[1,2,3]'), 0)` |
2230
| [GET_PATH](json/get-path) | Gets a value from a JSON object using a path expression | `GET_PATH(json_obj, 'user.name')` |
2331
| [GET_IGNORE_CASE](json/get-ignore-case) | Gets a value with case-insensitive key matching | `GET_IGNORE_CASE(json_obj, 'NAME')` |
24-
| [JSON_EACH](json/json-each) | Expands JSON object into key-value pairs | `JSON_EACH(PARSE_JSON('{"a":1,"b":2}'))` |
25-
| [JSON_ARRAY_ELEMENTS](json/json-array-elements) | Expands JSON array into individual elements | `JSON_ARRAY_ELEMENTS(PARSE_JSON('[1,2,3]'))` |
32+
| [JSON_EXTRACT_PATH_TEXT](json/json-extract-path-text) | Extracts text value from JSON using path | `JSON_EXTRACT_PATH_TEXT(json_obj, 'name')` |
33+
34+
### Transformation & Output
35+
| Function | Description | Example |
36+
|----------|-------------|--------|
37+
| [JSON_TO_STRING](json/json-to-string) | Converts a JSON value to a string | `JSON_TO_STRING(PARSE_JSON('{"a":1}'))` |
2638
| [JSON_PRETTY](json/json-pretty) | Formats JSON with proper indentation | `JSON_PRETTY(PARSE_JSON('{"a":1}'))` |
2739
| [STRIP_NULL_VALUE](json/strip-null-value) | Removes null values from JSON | `STRIP_NULL_VALUE(PARSE_JSON('{"a":1,"b":null}'))` |
2840

41+
### Array/Object Expansion
42+
| Function | Description | Example |
43+
|----------|-------------|--------|
44+
| [JSON_EACH](json/json-each) | Expands JSON object into key-value pairs | `JSON_EACH(PARSE_JSON('{"a":1,"b":2}'))` |
45+
| [JSON_ARRAY_ELEMENTS](json/json-array-elements) | Expands JSON array into individual elements | `JSON_ARRAY_ELEMENTS(PARSE_JSON('[1,2,3]'))` |
46+
2947
## Array Functions
3048

3149
| Function | Description | Example |

0 commit comments

Comments
 (0)