You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dong (JIRA)" <ji...@apache.org> on 2019/02/13 07:05:00 UTC
[jira] [Updated] (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: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 & 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)
Re: [jira] [Updated] (FLINK-11590) Redundant spaces occur when the
string true is generated using 'case when' grammar
Posted by Coo1 min <gj...@gmail.com>.
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) <ji...@apache.org> 于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 & 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)
>