Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/20579#discussion_r173625828
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/FileBasedDataSourceSuite.scala ---
@@ -72,6 +72,29 @@ class FileBasedDataSourceSuite extends QueryTest with
SharedSQLContext {
}
}
+ // Text and Parquet format does not allow wrting data frame with empty
schema.
+ Seq("parquet", "text").foreach { format =>
+ test(s"SPARK-23372 writing empty dataframe should produce
AnalysisException - $format") {
+ withTempPath { outputPath =>
+ intercept[AnalysisException] {
+
spark.emptyDataFrame.write.format(format).save(outputPath.toString)
+ }
+ }
+ }
+ }
+
+ // Formats excluding text and parquet allow writing empty data frames to
files.
+ allFileBasedDataSources.filterNot(p => p == "text" || p ==
"parquet").foreach { format =>
+ test(s"SPARK-23372 writing empty dataframe and reading from it -
$format") {
+ withTempPath { outputPath =>
+
spark.emptyDataFrame.write.format(format).save(outputPath.toString)
+ intercept[AnalysisException] {
+ val df = spark.read.format(format).load(outputPath.toString)
--- End diff --
Sorry if I misunderstood. The link is
https://github.com/apache/spark/pull/20579#issuecomment-364994881. Is that the
right link?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]