[
https://issues.apache.org/jira/browse/FLINK-21582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295872#comment-17295872
]
jibiyr edited comment on FLINK-21582 at 3/5/21, 2:03 PM:
---------------------------------------------------------
[~twalthr] [~jark]
I debug and found the coalesce function is parsed to *case-when*,because the
sqlType's nullable of CAST REXCALL is false
,so the case-when result is *cast('aa' as int) not null*,however the CAST
ExprCodeGen resultTerm is null.
I think the nullable of cast('aa' as int) should be true.
was (Author: yr):
[~twalthr] [~jark]
hi wu,I found that coalsece is rewriter to case when after parse,when the
case-when sqlNode after simplify is *cast('aa' as int) not null*
,so the case-when result is *cast('aa' as int) not null*,however the CAST
ExprCodeGen resultTerm is null.
I think the nullable of cast('aa' as int) should be true.
> COALESCE not works when cast a variable return null
> ---------------------------------------------------
>
> Key: FLINK-21582
> URL: https://issues.apache.org/jira/browse/FLINK-21582
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.11.1
> Environment: Flink1.11.1
>
> Reporter: Jerry
> Priority: Minor
> Attachments: image-2021-03-03-19-48-21-306.png
>
>
> select COALESCE(cast('aa' as int), 0);return NULL
> select COALESCE(NULL, 0); return 0
> The first case works failed, but the second case works successful
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)