You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "谢波 (Jira)" <ji...@apache.org> on 2021/01/27 10:04:00 UTC

[jira] [Created] (FLINK-21162) FLINK SQL IF function semantic incorrect

谢波 created FLINK-21162:
--------------------------

             Summary: 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: 谢波


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)