You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/23 07:48:14 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #30893: [SPARK-33881][SQL][TESTS] Check null and empty string as partition values in DS v1 and v2 tests

MaxGekk commented on a change in pull request #30893:
URL: https://github.com/apache/spark/pull/30893#discussion_r547766855



##########
File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowPartitionsSuite.scala
##########
@@ -17,6 +17,31 @@
 
 package org.apache.spark.sql.hive.execution.command
 
+import org.apache.spark.sql.{Row, SaveMode}
 import org.apache.spark.sql.execution.command.v1
 
-class ShowPartitionsSuite extends v1.ShowPartitionsSuiteBase with CommandSuiteBase
+class ShowPartitionsSuite extends v1.ShowPartitionsSuiteBase with CommandSuiteBase {
+  test("null and empty string as partition values") {

Review comment:
       It fails with NPE :-(
   
   ```scala
     test("null and empty string as partition values") {
       import testImplicits._
       withNamespaceAndTable("ns", "tbl") { t =>
         val df = Seq((0, ""), (1, null)).toDF("a", "part")
         df.write
           .partitionBy("part")
           .format("parquet")
           .mode(SaveMode.Overwrite)
           .saveAsTable(t)
   
         runShowPartitionsSql(s"SHOW PARTITIONS $t", Row("part=null") :: Nil)
       }
     }
   ```
   ```
   java.lang.NullPointerException was thrown.
   java.lang.NullPointerException
   	at org.apache.spark.sql.execution.datasources.v2.ShowPartitionsExec.$anonfun$run$3(ShowPartitionsExec.scala:58)
   	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:238)
   ```
   Let me fix this separately since this PR is about tests. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org