xubo245 commented on a change in pull request #3834:
URL: https://github.com/apache/carbondata/pull/3834#discussion_r460359320



##########
File path: 
hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonFileInputFormat.java
##########
@@ -260,7 +265,50 @@ public boolean accept(CarbonFile file) {
         getDataBlocksOfSegment(job, carbonTable, indexFilter, validSegments,
             new ArrayList<Segment>(), new ArrayList<String>());
     numBlocks = dataBlocksOfSegment.size();
-    result.addAll(dataBlocksOfSegment);
-    return result;
+    List<String> allDeleteDeltaFiles = 
getAllDeleteDeltaFiles(carbonTable.getTablePath());
+    if(allDeleteDeltaFiles.size() > 0) {
+      for (CarbonInputSplit split : dataBlocksOfSegment) {
+        split.setDeleteDeltaFiles(getDeleteDeltaFiles(split.getFilePath(), 
allDeleteDeltaFiles));
+      }
+    }
+    return new LinkedList<>(dataBlocksOfSegment);
+  }
+
+  private List<String> getAllDeleteDeltaFiles(String path) {
+    List<String> deltaFiles = null;
+    try (Stream<Path> walk = Files.walk(Paths.get(path))) {
+      deltaFiles = walk.map(x -> x.toString())
+          .filter(f -> f.endsWith(CarbonCommonConstants.DELETE_DELTA_FILE_EXT))
+          .collect(Collectors.toList());
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+    return deltaFiles;
+  }
+
+  private String[] getDeleteDeltaFiles(String segmentPath, List<String> 
allDeleteDeltaFiles) {
+    ArrayList<String> deleteDeltaFiles = new ArrayList<>();
+    String[] pathElements = 
segmentPath.split(CarbonCommonConstants.FILE_SEPARATOR);
+    String segmentFileName = pathElements[pathElements.length - 1];

Review comment:
       Please conside windows path




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to