You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "aitozi (JIRA)" <ji...@apache.org> on 2019/02/13 07:59:00 UTC

[jira] [Commented] (FLINK-11590) Redundant spaces occur when the string true is generated using 'case when' grammar

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

aitozi commented on FLINK-11590:
--------------------------------

Hi,  [~jiaqiang]

 
I think this is due to the `case when` expression will have the longest length of all branches, so in the example you post , It will be char(5). And a CHAR value will always be right-padded with the spaces to the declared length.
 
You can fix this by cast the type to varchar or use the trim() function. And I think this is not a bug but we can add a notice in the flink doc.
 
Thanks,
Aitozi

> Redundant spaces occur when the string true is generated using 'case when' grammar
> ----------------------------------------------------------------------------------
>
>                 Key: FLINK-11590
>                 URL: https://issues.apache.org/jira/browse/FLINK-11590
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API &amp; SQL
>    Affects Versions: 1.6.4, 1.7.0
>            Reporter: dong
>            Priority: Major
>
> {code:java}
> case when conditionA then 'false'  else 'true'  end as field
> {code}
> When I execute the above statement, if the field is true, the output will be 'true ' with an extra space.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)