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

Data Platform edited comment on CALCITE-4710 at 7/31/21, 10:09 AM:
-------------------------------------------------------------------

I found that this problem can be circumvented by adding an empty string to the 
constant.

Like this:

insert into OutputStream select "zz" as name_a, case when xdr.name_b is not 
null then ""++"AAAAA" else ""++"BB" end as name_b from InStream as xdr;

Hope it helps.


was (Author: season):
I found that this problem can be circumvented by adding an empty string to the 
constant.

Like this:

insert into OutputStream select "zz" as name_a, case when xdr.name_b is not 
null then ""+"AAAAA" else ""+"BB" end as name_b from InStream as xdr;

Hope it helps.

> In the special scenario of the case when statement, the constant RexNode 
> fails to be parsed.
> --------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4710
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4710
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.20.0, 1.27.0
>            Reporter: Data Platform
>            Priority: Major
>              Labels: features
>
> I found that calcite had problems parsing the "case when" statement since 
> version 1.20.0.
> insert into OutputStream select "zz" as name_a, case when xdr.name_b is not 
> null then "AAAAA" else "BB" end as name_b from InStream as xdr;
> ----
> use calcite (version:1.20.0)to parse the Streamming SQL:
> in the "case when" statement, The analysis result is not Correct of 
> RexLiteral "BB":
> Result:
> Correct:      RexLiteral "AAAAA" :   type ="CHAR(5)" , digest="'AAAAA'"
> Error:        RexLiteral "BB" :   type ="CHAR(5)" , digest="'BB      '"     
> I found that the parsing result of the constant "BB" is aligned with that of 
> the constant "AAAAA", The missing bits are filled with spaces.
> ----
> use calcite (version:1.17.0)to parse the Streamming SQL:
> In the "case when" statement, The analysis result is as expected:
> Result:
> Correct:      RexLiteral "AAAAA" :   type ="CHAR(5)" , digest="'AAAAA'"
> Correct:      RexLiteral "BB" :   type ="CHAR(2)" , digest="'BB'" 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to