You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ku...@apache.org on 2020/06/01 06:59:18 UTC

[carbondata] branch master updated: [CARBONDATA-3839]Fix rename file failed for FilterFileSystem DFS object

This is an automated email from the ASF dual-hosted git repository.

kunalkapoor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git


The following commit(s) were added to refs/heads/master by this push:
     new c4f98c1  [CARBONDATA-3839]Fix rename file failed for FilterFileSystem DFS object
c4f98c1 is described below

commit c4f98c1e69491428092392f00d68afdd5014a1f5
Author: akashrn5 <ak...@gmail.com>
AuthorDate: Mon Jun 1 09:58:31 2020 +0530

    [CARBONDATA-3839]Fix rename file failed for FilterFileSystem DFS object
    
    Why is this PR needed?
    Rename file fails in HDFS when the FS object is of FilterFileSystem,
    (which basically can contain any filesystem to use as basic filesystem)
    
    What changes were proposed in this PR?
    While rename force, have a check for this FS object
    
    This closes #3781
---
 .../apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
index ac508c3..7d36f0e 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/filesystem/HDFSCarbonFile.java
@@ -23,6 +23,7 @@ import org.apache.carbondata.common.logging.LogServiceFactory;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FilterFileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.apache.log4j.Logger;
@@ -77,6 +78,11 @@ public class HDFSCarbonFile extends AbstractDFSCarbonFile {
         ((DistributedFileSystem) fileSystem).rename(path, new Path(changetoName),
             org.apache.hadoop.fs.Options.Rename.OVERWRITE);
         return true;
+      } else if ((fileSystem instanceof FilterFileSystem) && (((FilterFileSystem) fileSystem)
+          .getRawFileSystem() instanceof DistributedFileSystem)) {
+        ((DistributedFileSystem) ((FilterFileSystem) fileSystem).getRawFileSystem())
+            .rename(path, new Path(changetoName), org.apache.hadoop.fs.Options.Rename.OVERWRITE);
+        return true;
       } else {
         return fileSystem.rename(path, new Path(changetoName));
       }