public static ContentSummary getInputSummary(final Context ctx, MapWork work, PathFilter filter)
      throws IOException {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogBegin(CLASS_NAME, PerfLogger.INPUT_SUMMARY);

    final long[] summary = {0L, 0L, 0L};
    final Set<Path> pathNeedProcess = new HashSet<>();

      // For each input path, calculate the total size.
      for (final Path path : work.getPathToAliases().keySet()) {
        if (path == null) {
          continue;
        }
        if (filter != null && !filter.accept(path)) {
          continue;
        }

        ContentSummary cs = ctx.getCS(path);
        if (cs != null) {
          summary[0] += cs.getLength();
          summary[1] += cs.getFileCount();
          summary[2] += cs.getDirectoryCount();
        } else {
          pathNeedProcess.add(path);
        }
      }

      // Process the case when name node call is needed
      final ExecutorService executor;

      int numExecutors = getMaxExecutorsForInputListing(ctx.getConf(), pathNeedProcess.size());
      if (numExecutors > 1) {
        // Since multiple threads could call this method concurrently, locking
        // this method will avoid number of threads out of control.
        synchronized (INPUT_SUMMARY_LOCK) {
          LOG.info("Using {} threads for getContentSummary", numExecutors);
          executor = Executors.newFixedThreadPool(numExecutors,
              new ThreadFactoryBuilder().setDaemon(true)
                  .setNameFormat("Get-Input-Summary-%d").build());
          getInputSummaryWithPool(ctx, Collections.unmodifiableSet(pathNeedProcess),
              work, summary, executor);
        }
      } else {
        LOG.info("Not using thread pool for getContentSummary");
        executor = MoreExecutors.newDirectExecutorService();
        getInputSummaryWithPool(ctx, Collections.unmodifiableSet(pathNeedProcess),
            work, summary, executor);
      }
      perfLogger.perfLogEnd(CLASS_NAME, PerfLogger.INPUT_SUMMARY);

    return new ContentSummary.Builder().length(summary[0])
        .fileCount(summary[1]).directoryCount(summary[2]).build();
  }
Calculate the total size of input files.

@param ctx
         the hadoop job context
@param work
         map reduce job plan
@param filter
         filter to apply to the input paths before calculating size
@return the summary of all the input paths.
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java