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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Aitozi
Hi, dong

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

dong (JIRA) <[hidden email]> 于2019年2月13日周三 下午3:05写道:

>
>      [
> https://issues.apache.org/jira/browse/FLINK-11590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
>
> dong updated FLINK-11590:
> -------------------------
>     Description:
>
> {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.
>
>
> > 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)
>