java.lang.NullPointerException when working on data pulled in from hive table

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.NullPointerException when working on data pulled in from hive table

dataginjaninja
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I am getting the NPE only when using hive:

val hc = new org.apache.spark.sql.hive.HiveContext(sc)
val data = hc.hql("SELECT * FROM aol")

the first time I collect:

org.apache.spark.SparkException: Job aborted due to stage failure: Task 23.0:18 failed 4 times, most recent failure: Exception failure in TID 388 on host ec2.internal: java.lang.NullPointerException
        $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$anonfun$2.apply(<console>:21)
        $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$anonfun$2.apply(<console>:21)
        scala.collection.Iterator$$anon$11.next(Iterator.scala:328)
        org.apache.spark.Aggregator.combineValuesByKey(Aggregator.scala:59)
        org.apache.spark.rdd.PairRDDFunctions$$anonfun$1.apply(PairRDDFunctions.scala:96)
        org.apache.spark.rdd.PairRDDFunctions$$anonfun$1.apply(PairRDDFunctions.scala:95)
        org.apache.spark.rdd.RDD$$anonfun$14.apply(RDD.scala:582)
        org.apache.spark.rdd.RDD$$anonfun$14.apply(RDD.scala:582)
        org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:35)
        org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:262)
        org.apache.spark.rdd.RDD.iterator(RDD.scala:229)
        org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:158)
        org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:99)
        org.apache.spark.scheduler.Task.run(Task.scala:51)
        org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:187)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        java.lang.Thread.run(Thread.java:744)
Driver stacktrace:
        at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1033)
        at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1017)
        at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1015)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
        at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1015)
        at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:633)
        at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:633)
        at scala.Option.foreach(Option.scala:236)
        at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:633)
        at org.apache.spark.scheduler.DAGSchedulerEventProcessActor$$anonfun$receive$2.applyOrElse(DAGScheduler.scala:1207)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498)
        at akka.actor.ActorCell.invoke(ActorCell.scala:456)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237)
        at akka.dispatch.Mailbox.run(Mailbox.scala:219)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)


However, the exact same list of commands fails differently when data comes from hdfs:

val queries = sc.textFile("hdfs://path:port/user/ubuntu/data/aol/*")
val data = queries.map(line => line.split('\t'))

org.apache.spark.SparkException: Job aborted due to stage failure: Task 3.0:2 failed 4 times, most recent failure: Exception failure in TID 119 on host ip-10-81-150-35.ec2.internal: java.net.ConnectException: Connection timed out
        java.net.PlainSocketImpl.socketConnect(Native Method)
        java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        java.net.Socket.connect(Socket.java:579)
        java.net.Socket.connect(Socket.java:528)
        sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
        sun.net.www.http.HttpClient.New(HttpClient.java:308)
        sun.net.www.http.HttpClient.New(HttpClient.java:326)
        sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
        sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
        sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
        sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
        org.apache.spark.broadcast.HttpBroadcast$.read(HttpBroadcast.scala:196)
        org.apache.spark.broadcast.HttpBroadcast.readObject(HttpBroadcast.scala:89)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

However, when using a small subset of data all of the commands work. Is this because the data is too big?
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.NullPointerException when working on data pulled in from hive table

dataginjaninja
This post has NOT been accepted by the mailing list yet.
Never mind, adding more memory fixed the issue.