[jira] [Comment Edited] (FLINK-35687) JSON_QUERY should return a proper JSON for ARRAY

2024-06-24 Thread Dawid Wysakowicz (Jira)


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

Dawid Wysakowicz edited comment on FLINK-35687 at 6/24/24 1:05 PM:
---

> Existing applications since Flink 1.15 (when this came in) will expect the 
> existing response - so are likely to break and need changing

That's not true. `RETURNING` clause was introduced in 1.19. 

Moreover, I don't think we should maintain incorrect behaviour just because 
someone depends on an incorrect behaviour. 


was (Author: dawidwys):
> Existing applications since Flink 1.15 (when this came in) will expect the 
> existing response - so are likely to break and need changing

That's not true. `RETURNING` clause was introduced in 1.19. 

I don't think we should maintain incorrect behaviour just because someone 
depends on an incorrect behaviour. 

> JSON_QUERY should return a proper JSON for ARRAY
> 
>
> Key: FLINK-35687
> URL: https://issues.apache.org/jira/browse/FLINK-35687
> Project: Flink
>  Issue Type: Bug
>  Components: Table SQL / Planner
>Affects Versions: 1.19.1
>Reporter: Dawid Wysakowicz
>Assignee: Dawid Wysakowicz
>Priority: Major
> Fix For: 1.20.0, 1.19.2
>
>
> {code}
> SELECT JSON_QUERY('{"items": [{"itemId":1234, "count":10}]}', '$.items' 
> RETURNING ARRAY)
> {code}
> returns
> {code}
> {itemId=1234, count=10}
> {code}
> but it should:
> {code}
> {"itemId":1234, "count":10}
> {code}
> We should call jsonize for Collection types here: 
> https://github.com/apache/flink/blob/f6f88135b3a5fa5616fe905346e5ab6dce084555/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlJsonUtils.java#L268



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


[jira] [Comment Edited] (FLINK-35687) JSON_QUERY should return a proper JSON for ARRAY

2024-06-24 Thread david radley (Jira)


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

david radley edited comment on FLINK-35687 at 6/24/24 1:07 PM:
---

[~dwysakowicz] I agree your proposal does look better and matches the 
documentation. I am concerned that there is a migration issue, as you have 
targeted 1.20 and 1.19 and this is an SQL API change (even if it is a 
correction). Existing applications since Flink 1.15 (when this came in) will 
expect the existing response - so are likely to break and need changing. If we 
want to target 1.19 and 1.20, I suggest having a config switch that would 
enable this behaviour, or wait for Flink 2.0 - where more breaking changes are 
appropriate.  


was (Author: JIRAUSER300523):
[~dwysakowicz] I agree your proposal does look better. I am concerned that 
there is a migration issue, as you have targeted 1.20 and 1.19 and this is an 
SQL API change. Existing applications since Flink 1.15 (when this came in) will 
expect the existing response - so are likely to break and need changing. If we 
want to target 1.19 and 1.20, I suggest having a config switch that would 
enable this behaviour, or wait for Flink 2.0 - where more breaking changes are 
appropriate.  

> JSON_QUERY should return a proper JSON for ARRAY
> 
>
> Key: FLINK-35687
> URL: https://issues.apache.org/jira/browse/FLINK-35687
> Project: Flink
>  Issue Type: Bug
>  Components: Table SQL / Planner
>Affects Versions: 1.19.1
>Reporter: Dawid Wysakowicz
>Assignee: Dawid Wysakowicz
>Priority: Major
> Fix For: 1.20.0, 1.19.2
>
>
> {code}
> SELECT JSON_QUERY('{"items": [{"itemId":1234, "count":10}]}', '$.items' 
> RETURNING ARRAY)
> {code}
> returns
> {code}
> {itemId=1234, count=10}
> {code}
> but it should:
> {code}
> {"itemId":1234, "count":10}
> {code}
> We should call jsonize for Collection types here: 
> https://github.com/apache/flink/blob/f6f88135b3a5fa5616fe905346e5ab6dce084555/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlJsonUtils.java#L268



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