You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "qihuang.zheng (JIRA)" <ji...@apache.org> on 2015/08/21 11:46:46 UTC

[jira] [Created] (SPARK-10156) sql in sql NullPointerException

qihuang.zheng created SPARK-10156:
-------------------------------------

             Summary: 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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org