GitHub user dongjoon-hyun opened a pull request:

    https://github.com/apache/spark/pull/19477

    [SPARK-22258][SQL] Writing empty dataset fails with ORC format

    ## What changes were proposed in this pull request?
    
    Since [SPARK-8501](https://issues.apache.org/jira/browse/SPARK-8501), Spark 
doesn't create an ORC file for empty data sets. However, 
[SPARK-21669](https://issues.apache.org/jira/browse/SPARK-21669) is trying to 
get the length of the written file at the end of writing tasks and fails with 
`FileNotFoundException`. This is a regression at 2.3.0 only. We had better fix 
this and have a test case to prevent future regression.
    
    ```scala
    scala> Seq("str").toDS.limit(0).write.format("orc").save("/tmp/a")
    17/10/11 19:28:59 ERROR Utils: Aborting task
    java.io.FileNotFoundException: File 
file:/tmp/a/_temporary/0/_temporary/attempt_20171011192859_0000_m_000000_0/part-00000-aa56c3cf-ec35-48f1-bb73-23ad1480e917-c000.snappy.orc
 does not exist
        at 
org.apache.hadoop.fs.RawLocalFileSystem.deprecatedGetFileStatus(RawLocalFileSystem.java:611)
        at 
org.apache.hadoop.fs.RawLocalFileSystem.getFileLinkStatusInternal(RawLocalFileSystem.java:824)
        at 
org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:601)
        at 
org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:421)
        at 
org.apache.spark.sql.execution.datasources.BasicWriteTaskStatsTracker.getFileSize(BasicWriteStatsTracker.scala:60)
    ```
    
    ## How was this patch tested?
    
    Pass the newly added test cases.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-22258

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/19477.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #19477
    
----
commit b545f281b19120cc2c9e4197cae4b1315969247d
Author: Dongjoon Hyun <dongj...@apache.org>
Date:   2017-10-12T02:38:51Z

    [SPARK-22258][SQL] Writing empty dataset fails with ORC format

----


---

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

Reply via email to