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 09:44:13 UTC

[carbondata] 06/08: [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 annotated tag apache-carbondata-2.0.1-rc1
in repository https://gitbox.apache.org/repos/asf/carbondata.git

commit 316ea18a8e3825090f1e9083b67dee278bb9a98c
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));
       }