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/05/13 05:21:26 UTC

[carbondata] branch master updated: [CARBONDATA-3811] Fix flat folder query returns 0 rows

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 4a70cd5  [CARBONDATA-3811] Fix flat folder query returns 0 rows
4a70cd5 is described below

commit 4a70cd5ba4e5fab9e943bd42768926c78cd54054
Author: ajantha-bhat <aj...@gmail.com>
AuthorDate: Tue May 12 14:55:58 2020 +0530

    [CARBONDATA-3811] Fix flat folder query returns 0 rows
    
    Why is this PR needed?
    This issue doesn't happen for local or s3a file system (because below method
    don't lookup from the map for those file system). observed with HDFS file system.
    In case of 'flat_folder'='true' table property,
    BlockletIndexUtil#createBlockMetaInfo method for HDFS looks up meta info
    from fileNameToMetaInfoMapping map.
    
    What changes were proposed in this PR?
    Path should not have // in first place. This was a bug in case of flat folder.
    
    This closes #3763
---
 .../org/apache/carbondata/core/metadata/SegmentFileStore.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java b/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java
index 3bf562a..335e0f5 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/SegmentFileStore.java
@@ -833,7 +833,13 @@ public class SegmentFileStore {
       for (Map.Entry<String, FolderDetails> entry : getLocationMap().entrySet()) {
         String location = entry.getKey();
         if (entry.getValue().isRelative) {
-          location = tablePath + location;
+          if (location.equals("/")) {
+            // incase of flat folder, the relative segment location is '/',
+            // so don't append it as we again add file separator for file names.
+            location = tablePath;
+          } else {
+            location = tablePath + location;
+          }
         }
         if (entry.getValue().status.equals(SegmentStatus.SUCCESS.getMessage())) {
           String mergeFileName = entry.getValue().getMergeFileName();