[ 
https://issues.apache.org/jira/browse/CALCITE-6365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17837656#comment-17837656
 ] 

Dawid Wysakowicz commented on CALCITE-6365:
-------------------------------------------

Sure [~asolimando].

What we in the Flink communit want to achieve is to be able to extract arrays 
from JSON data. Something like:

{code}
f0
--
'{ "a": "[1,2]", "b": [1,2], "c": "hi"}'

SELECT res, typeof(res) FROM (
SELECT JSON_QUERY(f0, '$.b' RETURNING ARRAY<VARCHAR(2000)> WITHOUT ARRAY 
WRAPPER) as res)

res             | typeof(res) 
-----------------------
["1", "2"].  | ARRAY<VARCHAR(2000)>

SELECT res, typeof(res) FROM (
SELECT JSON_QUERY(f0, '$.b' WITHOUT ARRAY WRAPPER) as res)

res             | typeof(res) 
-----------------------
'["1", "2"]'  | VARCHAR(2000)
{code}

> Support for RETURNING clause of JSON_QUERY
> ------------------------------------------
>
>                 Key: CALCITE-6365
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6365
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Dawid Wysakowicz
>            Priority: Major
>
> SQL standard says {{JSON_QUERY}} should support {{RETURNING}} clause similar 
> to {{JSON_VALUE}}. Calcite supports the clause for JSON_VALUE already, but 
> not for the JSON_QUERY.
> {code}
> <JSON query> ::=
>   JSON_QUERY <left paren>
>       <JSON API common syntax>
>       [ <JSON output clause> ]
>       [ <JSON query wrapper behavior> WRAPPER ]
>       [ <JSON query quotes behavior> QUOTES [ ON SCALAR STRING ] ]
>       [ <JSON query empty behavior> ON EMPTY ]
>       [ <JSON query error behavior> ON ERROR ]
>       <right paren>
> <JSON output clause> ::=
>   RETURNING <data type>
>       [ FORMAT <JSON representation> ]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to