[
https://issues.apache.org/jira/browse/SPARK-10156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
qihuang.zheng closed SPARK-10156.
---------------------------------
Resolution: Fixed
sorry, my fault. invoke sql("").map will not fire action. so row.get will not
get value. that's why npe happen. change map method to collect.foreach will
work.
> sql in sql NullPointerException
> -------------------------------
>
> Key: SPARK-10156
> URL: https://issues.apache.org/jira/browse/SPARK-10156
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.4.1
> Reporter: qihuang.zheng
>
> I Have two tables, outer and inner. After I query outer table, I will use the
> row value for the inner table. But get NullPointerException, here is the
> example:
> val rdd1 = sc.parallelize(List((1,"a"),(1,"b"),(1,"c")));
> rdd1.toDF("c1","c2").registerTempTable("test")
> cacheTable("test")
> val rdd2 = sc.parallelize(List(("a","A"),("a","AA"),("b","B"),("c","C")));
> rdd1.toDF("c1","c2").registerTempTable("test2")
> cacheTable("test2")
> val rdd = sql("select * from test").map(row=>{
> val k = row.getInt(0)
> val v = row.getString(1)
> val rddSet = sql(s"select collect_set(c2) from test2 where c1=$v")
> val set = rddSet.first().getSeq[String](0).toSet
> (k,v,set)
> })
> //NullPointerException
> rdd.count()
> And NPE:
> org.apache.spark.SparkException: Job aborted due to stage failure: Task 7 in
> stage 1.0 failed 4 times, most recent failure: Lost task 7.3 in stage 1.0
> (TID 23, 192.168.6.53): java.lang.NullPointerException
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]