Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-5284

Insert into Hive throws NPE when a inner complex type field has a null value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • SQL
    • None

    Description

      For a table like the following one,

      CREATE TABLE nullValuesInInnerComplexTypes
        (s struct<innerStruct: struct<s1:string>,
                  innerArray:array<int>,
                  innerMap: map<string, int>>)
      

      When we want to insert a row like this

      Row(Row(null, null, null))
      

      Will get a NPE

      [info]   org.apache.spark.SparkException: Job aborted due to stage failure: Task 1 in stage 0.0 failed 1 times, most recent failure: Lost task 1.0 in stage 0.0 (TID 1, localhost): java.lang.NullPointerException
      [info] 	at scala.runtime.Tuple3Zipped$.foreach$extension(Tuple3Zipped.scala:105)
      [info] 	at org.apache.spark.sql.hive.HiveInspectors$$anonfun$wrapperFor$3.apply(HiveInspectors.scala:351)
      [info] 	at org.apache.spark.sql.hive.HiveInspectors$$anonfun$wrapperFor$3$$anonfun$apply$4.apply(HiveInspectors.scala:351)
      [info] 	at org.apache.spark.sql.hive.HiveInspectors$$anonfun$wrapperFor$3$$anonfun$apply$4.apply(HiveInspectors.scala:351)
      [info] 	at scala.runtime.Tuple3Zipped$$anonfun$foreach$extension$1.apply(Tuple3Zipped.scala:109)
      [info] 	at scala.collection.Iterator$class.foreach(Iterator.scala:727)
      [info] 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
      [info] 	at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
      [info] 	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
      [info] 	at scala.runtime.Tuple3Zipped$.foreach$extension(Tuple3Zipped.scala:107)
      [info] 	at org.apache.spark.sql.hive.HiveInspectors$$anonfun$wrapperFor$3.apply(HiveInspectors.scala:351)
      [info] 	at org.apache.spark.sql.hive.execution.InsertIntoHiveTable$$anonfun$org$apache$spark$sql$hive$execution$InsertIntoHiveTable$$writeToFile$1$1.apply(InsertIntoHiveTable.scala:108)
      [info] 	at org.apache.spark.sql.hive.execution.InsertIntoHiveTable$$anonfun$org$apache$spark$sql$hive$execution$InsertIntoHiveTable$$writeToFile$1$1.apply(InsertIntoHiveTable.scala:105)
      [info] 	at scala.collection.Iterator$class.foreach(Iterator.scala:727)
      [info] 	at org.apache.spark.InterruptibleIterator.foreach(InterruptibleIterator.scala:28)
      [info] 	at org.apache.spark.sql.hive.execution.InsertIntoHiveTable.org$apache$spark$sql$hive$execution$InsertIntoHiveTable$$writeToFile$1(InsertIntoHiveTable.scala:105)
      [info] 	at org.apache.spark.sql.hive.execution.InsertIntoHiveTable$$anonfun$saveAsHiveFile$3.apply(InsertIntoHiveTable.scala:87)
      [info] 	at org.apache.spark.sql.hive.execution.InsertIntoHiveTable$$anonfun$saveAsHiveFile$3.apply(InsertIntoHiveTable.scala:87)
      [info] 	at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61)
      [info] 	at org.apache.spark.scheduler.Task.run(Task.scala:64)
      [info] 	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:192)
      [info] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      [info] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      [info] 	at java.lang.Thread.run(Thread.java:745)
      [info] 
      [info] Driver stacktrace:
      [info]   at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1199)
      [info]   at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1188)
      [info]   at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1187)
      [info]   at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
      [info]   at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
      [info]   at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1187)
      [info]   at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:697)
      [info]   at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:697)
      [info]   at scala.Option.foreach(Option.scala:236)
      [info]   at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:697)
      [info]   at org.apache.spark.scheduler.DAGSchedulerEventProcessActor$$anonfun$receive$2.applyOrElse(DAGScheduler.scala:1399)
      [info]   at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
      [info]   at org.apache.spark.scheduler.DAGSchedulerEventProcessActor.aroundReceive(DAGScheduler.scala:1360)
      [info]   at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
      [info]   at akka.actor.ActorCell.invoke(ActorCell.scala:487)
      [info]   at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
      [info]   at akka.dispatch.Mailbox.run(Mailbox.scala:220)
      [info]   at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
      [info]   at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
      [info]   at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
      [info]   at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
      [info]   at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            yhuai Yin Huai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: