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



##########
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);

Review comment:
       How to handle it in windows? WINDOWS_FILE_SEPARATOR?
   
   Suggestion:  File.separator




----------------------------------------------------------------
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:
[email protected]


Reply via email to