Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20579#discussion_r167625448
  
    --- 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 --
    
    This should pass right?


---

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

Reply via email to