Github user tejasapatil commented on a diff in the pull request: https://github.com/apache/spark/pull/10964#discussion_r51380186 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala --- @@ -2056,4 +2056,11 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { ) } } + + test("SPARK-13056: Null in map value causes NPE") { + val df = Seq(1 -> Map("abc" -> "somestring", "cba" -> null)).toDF("key", "value") + df.registerTempTable("maptest") + checkAnswer(sql("SELECT value['abc'] FROM maptest"), Row("somestring")) + checkAnswer(sql("SELECT value['cba'] FROM maptest"), Row(null)) --- End diff -- Have you verified if this throws NPE without this fix ? The test runs fine over trunk: ``` scala> val df = Seq(1 -> Map("abc" -> "somestring", "cba" -> null)).toDF("key", "value") df: org.apache.spark.sql.DataFrame = [key: int, value: map<string,string>] scala> df.registerTempTable("maptest") scala> sqlContext.sql("SELECT value['cba'] FROM maptest").collect() res28: Array[org.apache.spark.sql.Row] = Array([null]) scala> sqlContext.sql("SELECT value['cba'] FROM maptest").foreach(println) [null] ```
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org