Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-21162

FLINK SQL IF function semantic incorrect

    XMLWordPrintableJSON

Details

    Description

      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)

       

      Attachments

        Issue Links

          Activity

            People

              ZhaoWeiNan WeiNan Zhao
              hiscat 谢波
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: