SourabhBadhya commented on code in PR #4520:
URL: https://github.com/apache/hive/pull/4520#discussion_r1305568146


##########
ql/src/java/org/apache/hadoop/hive/ql/plan/ConditionalResolverMergeFiles.java:
##########
@@ -380,32 +432,32 @@ public int getNumFiles() {
   private AverageSize getAverageSize(FileSystem inpFs, Path dirPath) {
     AverageSize error = new AverageSize(-1, -1);
     try {
-      FileStatus[] fStats = inpFs.listStatus(dirPath);
-
-      long totalSz = 0;
-      int numFiles = 0;
-      for (FileStatus fStat : fStats) {
-        Utilities.FILE_OP_LOGGER.debug("Resolver looking at " + 
fStat.getPath());
-        if (fStat.isDir()) {
-          AverageSize avgSzDir = getAverageSize(inpFs, fStat.getPath());
-          if (avgSzDir.getTotalSize() < 0) {
-            return error;
-          }
-          totalSz += avgSzDir.getTotalSize();
-          numFiles += avgSzDir.getNumFiles();
-        }
-        else {
-          totalSz += fStat.getLen();
-          numFiles++;
-        }
-      }
-
-      return new AverageSize(totalSz, numFiles);
+      return getAverageSize(getFileStatus(inpFs, dirPath));
     } catch (IOException e) {
       return error;
     }
   }
 
+  private List<FileStatus> getFileStatus(FileSystem inputFs, Path path) throws 
IOException {

Review Comment:
   Done.



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to