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

Functions in ExplodeFunctionUtil should handle null data to avoid NPE

Agile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      The following test case will encounter NPE:

          val t = tEnv.fromValues(
            DataTypes.ROW(
              DataTypes.FIELD("a", DataTypes.INT()),
              DataTypes.FIELD("b", DataTypes.ARRAY(DataTypes.STRING()))
            ),
            row(1, Array("aa", "bb", "cc")),
            row(2, null),
            row(3, Array("dd"))
          )
          tEnv.registerTable("T", t)
      
          tEnv.executeSql("SELECT a, s FROM T, UNNEST(T.b) as A (s)").print()
      

      Exception is

      Caused by: java.lang.NullPointerException
      	at scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:192)
      	at scala.collection.mutable.ArrayOps$ofRef.length(ArrayOps.scala:192)
      	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:32)
      	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
      	at org.apache.flink.table.planner.plan.utils.ObjectExplodeTableFunc.eval(ExplodeFunctionUtil.scala:34)
      

      The reason is functions in ExplodeFunctionUtil do not handle null data. Since 1.12, the bug is fixed, see https://issues.apache.org/jira/browse/FLINK-18528

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            godfreyhe godfrey he
            godfreyhe godfrey he
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment