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

    https://github.com/apache/flink/pull/3598#discussion_r107863788
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java ---
    @@ -262,8 +265,13 @@ public FSDataOutputStream create(
        public boolean rename(final Path src, final Path dst) throws 
IOException {
                final File srcFile = pathToFile(src);
                final File dstFile = pathToFile(dst);
    -
    -           return srcFile.renameTo(dstFile);
    +           //Files.move fails if the destination directory doesn't exist
    +           if(dstFile.getParentFile()!= null && 
!dstFile.getParentFile().exists()){
    +                   
Files.createDirectories(dstFile.getParentFile().toPath());
    +           }
    +           //this throws an IOException if any error occurs
    +           Files.move(srcFile.toPath(), dstFile.toPath(), 
StandardCopyOption.REPLACE_EXISTING);
    --- End diff --
    
    If we want to preserve the old semantics, we should catch the exception and 
return `false` in that case.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to