You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ra...@apache.org on 2017/05/11 13:53:11 UTC

[21/50] carbondata git commit: Fixed relative store path issue while update and delete

Fixed relative store path issue while update and delete


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/2d1c729c
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/2d1c729c
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/2d1c729c

Branch: refs/heads/branch-1.1
Commit: 2d1c729c68fb2f50f55e5b258d8d134994d807d7
Parents: 5e85137
Author: ravipesala <ra...@gmail.com>
Authored: Sun May 7 08:39:28 2017 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Sun May 7 08:39:28 2017 +0530

----------------------------------------------------------------------
 .../carbondata/core/datastore/impl/FileFactory.java  | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/2d1c729c/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java b/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
index 27931fe..c32b956 100644
--- a/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
+++ b/core/src/main/java/org/apache/carbondata/core/datastore/impl/FileFactory.java
@@ -461,9 +461,18 @@ public final class FileFactory {
       case LOCAL:
       default:
         if (filePath != null && !filePath.isEmpty()) {
-          Path pathWithoutSchemeAndAuthority =
-              Path.getPathWithoutSchemeAndAuthority(new Path(filePath));
-          return pathWithoutSchemeAndAuthority.toString();
+          // If the store path is relative then convert to absolute path.
+          if (filePath.startsWith("./")) {
+            try {
+              return new File(filePath).getCanonicalPath();
+            } catch (IOException e) {
+              throw new RuntimeException(e);
+            }
+          } else {
+            Path pathWithoutSchemeAndAuthority =
+                Path.getPathWithoutSchemeAndAuthority(new Path(filePath));
+            return pathWithoutSchemeAndAuthority.toString();
+          }
         } else {
           return filePath;
         }