Ranganath Govardhanagiri created PHOENIX-7399:
-------------------------------------------------
Summary: JSON_VALUE function to retrieve JSON field value with
given data type
Key: PHOENIX-7399
URL: https://issues.apache.org/jira/browse/PHOENIX-7399
Project: Phoenix
Issue Type: Improvement
Reporter: Ranganath Govardhanagiri
This issue is an exact scenario as described in the #PHOENIX-7396.
The purpose of this Jira is to introduce new function for JSON data type to
retrieve the value of the given Json Document field key. The function should
also take data type as an argument to decode the document field value.
h2. *Function Grammar:*
*Name:* JSON_VALUE
*Arguments:*
| |*Expression*|*DataType*|
|1|Column Value|JSON|
|2|Json Field Key|The field key can represent any top level or nested fields
within the document. The caller should use "." notation for accessing nested
document elements and "[n]" notation for accessing nested array elements.
Unlike nested fields, top level document fields do not require any additional
character.|
|3|SQL Data Type|The data type that the client expects the value of the field
to be converted to while returning the value.|
*Definition:* The function returns the value of the given field key from the
JSON Document. The client is expected to provide the data type that is used for
decoding the value of the field key.
*Return Type:* PDataType (Depending on the third argument of the function, the
data type conversion takes place)
*Examples:*
* JSON_VALUE(COL, 'topfield', 'DOUBLE')
* JSON_VALUE(COL, 'topfield.nestedfield1', 'VARCHAR')
* JSON_VALUE(COL, 'topfield.nestedfield[2]', 'INTEGER')
Here, COL represents the column name of data type JSON.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)