[ https://issues.apache.org/jira/browse/FLINK-21162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272735#comment-17272735 ]
谢波 edited comment on FLINK-21162 at 1/27/21, 10:06 AM: ------------------------------------------------------- I using the COALESCE(return_flag, '') solve the problem, but i think this is a bug. hello [~Leonard Xu], [~jark] Can someone take a moment to look at this?thanks was (Author: hiscat): I using the COALESCE(return_flag, '') solve the problem, but i think this is a bug. > FLINK SQL IF function semantic incorrect > ---------------------------------------- > > Key: FLINK-21162 > URL: https://issues.apache.org/jira/browse/FLINK-21162 > Project: Flink > Issue Type: Bug > Components: Table SQL / API, Table SQL / Planner, Table SQL / Runtime > Affects Versions: 1.12.1 > Reporter: 谢波 > Priority: Major > > I have a job using IF() test condition. > when i use "IF(col = '', 'a', 'b'), WHEN col = '' return a ", it is ok. > when i use "IF(col IS NULL, 'a', 'b'), WHEN col = NULL return a ", it is ok. > when i use "IF(col = '' OR col IS NULL, 'a', 'b'),WHEN col = ''return a", it > is ok. > when i use "IF(col = '' OR col IS NULL, 'a', 'b'),WHEN col = NULL return b" > ,that's amazing. > The semantic seems like inccorrect. > > my table ddl: > CREATE TABLE print(a STRING, b STRING) WITH ( 'connector' = 'print' ); > my dml : > INSERT INTO print > SELECT return_flag, > IF(return_flag = '' OR return_flag IS NULL, 'N', 'Y') returnFlag > FROM header; > my test data: > 3> +I(,N) > 5> +I(X,Y) > 1> +I(null,Y) > 2> +I(,N) > 5> +I(null,Y) > 3> +I(,N) > -- This message was sent by Atlassian Jira (v8.3.4#803005)