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

    https://github.com/apache/spark/pull/17395#discussion_r107611325
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/FileFormatWriter.scala
 ---
    @@ -292,7 +292,10 @@ object FileFormatWriter extends Logging {
         override def execute(iter: Iterator[InternalRow]): Set[String] = {
           var fileCounter = 0
           var recordsInFile: Long = 0L
    -      newOutputWriter(fileCounter)
    +      // Skip the empty partition to avoid creating a mass of 'empty' 
files.
    +      if (iter.hasNext) {
    +        newOutputWriter(fileCounter)
    --- End diff --
    
    I proposed the similar PR before but got reverted. In this case, Parquet 
would not write out the footer and schema information. Namely, this will break 
the case below:
    
    ```scala
    spark.range(100).filter("id > 100").write.parquet("/tmp/abc")
    spark.read.parquet("/tmp/abc").show()
    ```
    
    Up to my knowledge, we don't have test cases for them.


---
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]

Reply via email to