Skip to content

Commit

Permalink
json-functions: Update status and links (#8762) (#9020)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jun 20, 2022
1 parent f2704ce commit cc5ca9e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions functions-and-operators/json-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ summary: Learn about JSON functions.
>
> This is still an experimental feature. It is **NOT** recommended that you use it in the production environment.
TiDB supports most of the JSON functions that shipped with the GA release of MySQL 5.7. Additional JSON functions were added to MySQL 5.7 after its release, and not all are available in TiDB (see [unsupported functions](#unsupported-functions)).
TiDB supports most of the JSON functions that shipped with the GA release of MySQL 5.7.

## Functions that create JSON values

Expand Down Expand Up @@ -40,6 +40,7 @@ TiDB supports most of the JSON functions that shipped with the GA release of MyS
| [JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)][json_array_insert] | Inserts an array into the json document and returns the modified document |
| [JSON_INSERT(json_doc, path, val[, path, val] ...)][json_insert] | Inserts data into a JSON document and returns the result |
| [JSON_MERGE(json_doc, json_doc[, json_doc] ...)][json_merge] | A deprecated alias for `JSON_MERGE_PRESERVE` |
| [JSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)][json_merge_patch] | Merge JSON documents |
| [JSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)][json_merge_preserve] | Merges two or more JSON documents and returns the merged result |
| [JSON_REMOVE(json_doc, path[, path] ...)][json_remove] | Removes data from a JSON document and returns the result |
| [JSON_REPLACE(json_doc, path, val[, path, val] ...)][json_replace] | Replaces existing values in a JSON document and returns the result |
Expand All @@ -55,28 +56,22 @@ TiDB supports most of the JSON functions that shipped with the GA release of MyS
| [JSON_DEPTH(json_doc)][json_depth] | Returns the maximum depth of a JSON document |
| [JSON_LENGTH(json_doc[, path])][json_length] | Returns the length of a JSON document, or, if a path argument is given, the length of the value within the path |
| [JSON_TYPE(json_val)][json_type] | Returns a string indicating the type of a JSON value |
| [JSON_VALID(json_doc)][json_valid] | Checks if a json_doc is valid JSON. Useful for checking a column before converting it to the json type. |
| [JSON_VALID(json_doc)][json_valid] | Checks if a json\_doc is valid JSON. Useful for checking a column before converting it to the json type. |

## Utility Functions

| Function Name | Description |
| --------------------------------- | ----------- |
| [JSON_PRETTY(json_doc)][json_pretty] | Pretty formatting of a JSON document |
| [JSON_STORAGE_SIZE(json_doc)][json_storage_size] | Returns an approximate size of bytes required to store the json value. As the size does not account for TiKV using compression, the output of this function is not strictly compatible with MySQL. |

## Aggregate Functions

| Function Name | Description |
| --------------------------------- | ----------- |
| [JSON_ARRAYAGG(key)][json_arrayagg] | Provides an aggregation of keys. |
| [JSON_OBJECTAGG(key, value)][json_objectagg] | Provides an aggregation of values for a given key. |

## Unsupported functions

The following JSON functions are unsupported in TiDB. You can track the progress in adding them in [TiDB #7546](https://github.com/pingcap/tidb/issues/7546):

* `JSON_MERGE_PATCH`
* `JSON_PRETTY`
* `JSON_ARRAYAGG`

## See also

* [JSON Function Reference](https://dev.mysql.com/doc/refman/5.7/en/json-function-reference.html)
Expand All @@ -102,6 +97,8 @@ The following JSON functions are unsupported in TiDB. You can track the progress

[json_merge]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge

[json_merge_patch]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge-patch

[json_merge_preserve]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-merge-preserve

[json_object]: https://dev.mysql.com/doc/refman/5.7/en/json-creation-functions.html#function_json-object
Expand Down Expand Up @@ -131,3 +128,11 @@ The following JSON functions are unsupported in TiDB. You can track the progress
[json_array_append]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-array-append

[json_array_insert]: https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html#function_json-array-insert

[json_arrayagg]: https://dev.mysql.com/doc/refman/5.7/en/aggregate-functions.html#function_json-arrayagg

[json_objectagg]: https://dev.mysql.com/doc/refman/5.7/en/aggregate-functions.html#function_json-objectagg

[json_pretty]: https://dev.mysql.com/doc/refman/5.7/en/json-utility-functions.html#function_json-pretty

[json_storage_size]: https://dev.mysql.com/doc/refman/5.7/en/json-utility-functions.html#function_json-storage-size

0 comments on commit cc5ca9e

Please sign in to comment.