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 e91a645  [CARBONDATA-4022] Fix invalid path issue for segment added 
through alter add segment query
e91a645 is described below

commit e91a645f53793f54a8f8b6e1a7256dc7c29c7a09
Author: Karan980 <[email protected]>
AuthorDate: Fri Nov 20 17:11:16 2020 +0530

    [CARBONDATA-4022] Fix invalid path issue for segment added through alter 
add segment query
    
    Why is this PR needed?
    Segment Added through alter table add segment query doesn't require 
tablepath in its
    filepath, because the segment is present at some external location which is 
not inside
    the table.
    
    What changes were proposed in this PR?
    Filepath for normal segments (which are not added through alter table add 
segment query)
    is tablePath + filePath. But for segments added through alter table add 
segment query
    doesn't require tablePath, so we directly use the filePath of the segment.
    
    This closes #4017
---
 .../org/apache/carbondata/core/indexstore/ExtendedBlocklet.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlocklet.java
 
b/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlocklet.java
index edb921b..e0b21d5 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlocklet.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/indexstore/ExtendedBlocklet.java
@@ -20,6 +20,7 @@ package org.apache.carbondata.core.indexstore;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.DataOutputStream;
+import java.io.File;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
@@ -219,7 +220,12 @@ public class ExtendedBlocklet extends Blocklet {
     if (in.readBoolean()) {
       indexUniqueId = in.readUTF();
     }
-    setFilePath(tablePath + getPath());
+    String filePath = getPath();
+    if (filePath.startsWith(File.separator)) {
+      setFilePath(tablePath + filePath);
+    } else {
+      setFilePath(filePath);
+    }
     boolean isSplitPresent = in.readBoolean();
     if (isSplitPresent) {
       // getting the length of the data

Reply via email to