You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by GitBox <gi...@apache.org> on 2020/08/05 05:13:08 UTC

[GitHub] [carbondata] kunal642 commented on a change in pull request #3855: [CARBONDATA-3863], after using index service clean the temp data

kunal642 commented on a change in pull request #3855:
URL: https://github.com/apache/carbondata/pull/3855#discussion_r465476995



##########
File path: core/src/main/java/org/apache/carbondata/core/datastore/filesystem/LocalCarbonFile.java
##########
@@ -485,4 +486,30 @@ public boolean equals(Object o) {
   public int hashCode() {
     return Objects.hash(file.getAbsolutePath());
   }
+
+  @Override
+  public List<CarbonFile> listDirs() throws IOException {
+    if (!file.isDirectory()) {
+      return new ArrayList<CarbonFile>();
+    }
+    Collection<File> fileCollection = FileUtils.listFilesAndDirs(file,
+            DirectoryFileFilter.DIRECTORY, null);
+    if (fileCollection.isEmpty()) {
+      return new ArrayList<CarbonFile>();
+    }
+    List<CarbonFile> carbonFiles = new ArrayList<CarbonFile>();
+    for (File file : fileCollection) {
+      if (file.isDirectory()) {
+        File[] files = file.listFiles();

Review comment:
       This is a generic API.. i think the output for this should be "fileCollection" i.e listing only once...if you want to list the subfolder then better to add a recursive parameter or pass a pattern like /tmp/*/* so that it can list the folders with 2 depth.




----------------------------------------------------------------
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:
users@infra.apache.org