Github user brkyvz commented on a diff in the pull request:
https://github.com/apache/spark/pull/15951#discussion_r88934128
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
---
@@ -573,4 +573,39 @@ class DataFrameReaderWriterSuite extends QueryTest
with SharedSQLContext with Be
}
}
}
+
+ test("SPARK-18510: Data corruption from user specified partition column
schemas") {
+ import org.apache.spark.sql.functions.udf
+ import testImplicits._
+ withTempDir { src =>
+ val createArray = udf { (length: Long) =>
+ for (i <- 1 to length.toInt) yield i.toString
+ }
+ spark.range(4).select(createArray('id + 1) as 'ex, 'id, 'id % 4 as
'part).coalesce(1).write
+ .partitionBy("part", "id")
+ .mode("overwrite")
+ .parquet(src.toString)
+ // make sure to specify the schema in the wrong order. Partition
column in the middle, etc.
--- End diff --
with the fix, it still does not matter. The comment is outdated, I thought
something else was the problem. In terms of schema though, the output from
Spark is always consistent, i.e. partition columns go last.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]