This is an automated email from the ASF dual-hosted git repository.
victoria pushed a commit to branch 32.0.0
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/32.0.0 by this push:
new 950d691ec67 Update descriptions of JSON functions (#17654)
950d691ec67 is described below
commit 950d691ec6766f360e1c5f3caab3b478faf14588
Author: Jill Osborne <[email protected]>
AuthorDate: Mon Feb 3 19:03:39 2025 +0000
Update descriptions of JSON functions (#17654)
Co-authored-by: Charles Smith <[email protected]>
---
docs/querying/sql-json-functions.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/docs/querying/sql-json-functions.md
b/docs/querying/sql-json-functions.md
index 35b4f5e3769..892c348b5c8 100644
--- a/docs/querying/sql-json-functions.md
+++ b/docs/querying/sql-json-functions.md
@@ -32,19 +32,19 @@ sidebar_label: "JSON functions"
Druid supports nested columns, which provide optimized storage and indexes for
nested data structures. See [Nested columns](./nested-columns.md) for more
information.
-You can use the following JSON functions to extract, transform, and create
`COMPLEX<json>` values.
+You can use the following JSON functions to extract, transform, and create
`COMPLEX<json>` objects.
| Function | Notes |
| --- | --- |
|`JSON_KEYS(expr, path)`| Returns an array of field names from `expr` at the
specified `path`.|
-|`JSON_OBJECT(KEY expr1 VALUE expr2[, KEY expr3 VALUE expr4, ...])` |
Constructs a new `COMPLEX<json>` object. The `KEY` expressions must evaluate to
string types. The `VALUE` expressions can be composed of any input type,
including other `COMPLEX<json>` values. `JSON_OBJECT` can accept
colon-separated key-value pairs. The following syntax is equivalent:
`JSON_OBJECT(expr1:expr2[, expr3:expr4, ...])`.|
-|`JSON_MERGE(expr1, expr2[, expr3 ...])`| Merges two or more JSON `STRING` or
`COMPLEX<json>` into one. Preserves the rightmost value when there are key
overlaps. Returning always a `COMPLEX<json>` type.|
+|`JSON_MERGE(expr1, expr2[, expr3 ...])`| Merges two or more JSON `STRING` or
`COMPLEX<json>` values into one, preserving the rightmost value when there are
key overlaps. Always returns a `COMPLEX<json>` object.|
+|`JSON_OBJECT(KEY expr1 VALUE expr2[, KEY expr3 VALUE expr4, ...])` |
Constructs a new `COMPLEX<json>` object from one or more expressions. The `KEY`
expressions must evaluate to string types. The `VALUE` expressions can be
composed of any input type, including other `COMPLEX<json>` objects. The
function can accept colon-separated key-value pairs. The following syntax is
equivalent: `JSON_OBJECT(expr1:expr2[, expr3:expr4, ...])`.|
|`JSON_PATHS(expr)`| Returns an array of all paths which refer to literal
values in `expr` in JSONPath format. |
|`JSON_QUERY(expr, path)`| Extracts a `COMPLEX<json>` value from `expr`, at
the specified `path`. |
-|`JSON_QUERY_ARRAY(expr, path)`| Extracts an `ARRAY<COMPLEX<json>>` value from
`expr` at the specified `path`. If value is not an `ARRAY`, it gets translated
into a single element `ARRAY` containing the value at `path`. The primary use
of this function is to extract arrays of objects to use as inputs to other
[array functions](./sql-array-functions.md).|
-|`JSON_VALUE(expr, path [RETURNING sqlType])`| Extracts a literal value from
`expr` at the specified `path`. If you specify `RETURNING` and an SQL type name
(such as `VARCHAR`, `BIGINT`, `DOUBLE`, etc) the function plans the query using
the suggested type. Otherwise, it attempts to infer the type based on the
context. If it can't infer the type, it defaults to `VARCHAR`.|
-|`PARSE_JSON(expr)`|Parses `expr` into a `COMPLEX<json>` object. This operator
deserializes JSON values when processing them, translating stringified JSON
into a nested structure. If the input is not a `VARCHAR` or it is invalid JSON,
this function will result in an error.|
-|`TRY_PARSE_JSON(expr)`|Parses `expr` into a `COMPLEX<json>` object. This
operator deserializes JSON values when processing them, translating stringified
JSON into a nested structure. If the input is not a `VARCHAR` or it is invalid
JSON, this function will result in a `NULL` value.|
+|`JSON_QUERY_ARRAY(expr, path)`| Extracts an `ARRAY<COMPLEX<json>>` value from
`expr` at the specified `path`. If the value isn't an `ARRAY`, the function
translates it into a single element `ARRAY` containing the value at `path`.
Mainly used to extract arrays of objects to use as inputs to other [array
functions](./sql-array-functions.md).|
+|`JSON_VALUE(expr, path [RETURNING sqlType])`| Extracts a literal value from
`expr` at the specified `path`. If you include `RETURNING` and specify a SQL
type (such as `VARCHAR`, `BIGINT`, `DOUBLE`) the function plans the query using
the suggested type. If `RETURNING` isn't included, the function attempts to
infer the type based on the context. If the function can't infer the type, it
defaults to `VARCHAR`.|
+|`PARSE_JSON(expr)`|Parses `expr` into a `COMPLEX<json>` object. This function
deserializes JSON values when processing them, translating stringified JSON
into a nested structure. If the input is invalid JSON or not a `VARCHAR`, it
returns an error.|
+|`TRY_PARSE_JSON(expr)`|Parses `expr` into a `COMPLEX<json>` object. This
operator deserializes JSON values when processing them, translating stringified
JSON into a nested structure. If the input is invalid JSON or not a `VARCHAR`,
it returns a `NULL` value.|
|`TO_JSON_STRING(expr)`|Serializes `expr` into a JSON string.|
### JSONPath syntax
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]