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

Jane Chan commented on FLINK-31375:
-----------------------------------

Hi [~jeff-zou], thanks for reporting this issue. I've reproduced it using 
Flink-1.15.1, 1.15.2, and 1.16.1

!image-2023-03-22-14-20-18-575.png|width=616,height=214!

This is a bug caused by 
[CALCITE-4603|https://issues.apache.org/jira/browse/CALCITE-4603], and has been 
fixed in Calcite 1.27.0

As a workaround, you can try manually casting 'abc' as varchar like the 
following.
{code:sql}
select * from (values(case when true then map['test','123456789'] else map 
['msg_code','0', 'msg_reason', cast('abc' as string)] end)); {code}

As release-1.17 has upgraded to Calcite 1.29.0, this issue has been fixed.

> the values of map<string,string> are truncated by the CASE WHEN function.
> -------------------------------------------------------------------------
>
>                 Key: FLINK-31375
>                 URL: https://issues.apache.org/jira/browse/FLINK-31375
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API, Table SQL / Runtime
>    Affects Versions: 1.15.1
>            Reporter: jeff-zou
>            Priority: Major
>         Attachments: image-2023-03-22-14-20-18-575.png
>
>
> the values of map<string,string> are truncated by the CASE WHEN function.
> {code:java}
> // sql
> create table test (a map<varchar, string>) with ('connector'='print');
> insert into test  select * from (values(case when true then 
> map['test','123456789'] else map ['msg_code','0', 'msg_reason', 'abc'] 
> end));{code}
> the result:
> {code:java}
> +I[{test=123}] {code}
> We hope the value of result is '123456789', but I get '123', the length is 
> limited by 'abc'.
>  



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

Reply via email to