Github user ericl commented on a diff in the pull request: https://github.com/apache/spark/pull/16071#discussion_r90302152 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/PartitionProviderCompatibilitySuite.scala --- @@ -205,6 +205,58 @@ class PartitionProviderCompatibilitySuite } } } + + test(s"SPARK-18635 special chars in partition values - partition management $enabled") { + withTable("test") { + spark.range(10) + .selectExpr("id", "id as A", "'%' as B") + .write.partitionBy("A", "B").mode("overwrite") + .saveAsTable("test") + assert(spark.sql("select * from test").count() == 10) + assert(spark.sql("select * from test where B = '%'").count() == 10) + assert(spark.sql("select * from test where B = '$'").count() == 0) + spark.range(10) + .selectExpr("id", "id as A", "'=' as B") + .write.mode("append").insertInto("test") + spark.sql("insert into test partition (A, B) select id, id, '%=' from range(10)") + assert(spark.sql("select * from test").count() == 30) + assert(spark.sql("select * from test where B = '%'").count() == 10) + assert(spark.sql("select * from test where B = '='").count() == 10) + assert(spark.sql("select * from test where B = '%='").count() == 10) + + // show partitions sanity check + val parts = spark.sql("show partitions test").collect().map(_.get(0)).toSeq + assert(parts.length == 30) + assert(parts.contains("A=0/B=%25")) + assert(parts.contains("A=0/B=%3D")) + assert(parts.contains("A=0/B=%25%3D")) + + // custom locations sanity check + withTempDir { dir => + spark.sql(s""" + |alter table test partition (A=0, B='%') + |set location '${dir.getAbsolutePath}'""".stripMargin) + assert(spark.sql("select * from test").count() == 29) // missing 1 --- End diff -- Since the partition was moved, there are no files in the new location. Hence -1 file
--- 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