Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/20621#discussion_r168910831
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetPartitionDiscoverySuite.scala
---
@@ -1120,4 +1120,16 @@ class ParquetPartitionDiscoverySuite extends
QueryTest with ParquetTest with Sha
Row(3, BigDecimal("2" * 30)) :: Nil)
}
}
+
+ test("SPARK-23436: invalid Dates should be inferred as String in
partition inference") {
+ withTempPath { path =>
+ val data = Seq(("1", "2018-01", "2018-01-01-04", "test"))
+ .toDF("id", "date_month", "date_hour", "data")
+
+ data.write.partitionBy("date_month",
"date_hour").parquet(path.getAbsolutePath)
+ val input = spark.read.parquet(path.getAbsolutePath)
+ checkAnswer(input.select("id", "date_month", "date_hour", "data"),
--- End diff --
shall we also check the schema to make sure that field is string type?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]