@SuppressWarnings("rawtypes")
  private ContentSummary runTestGetInputSummary(JobConf jobConf,
      Properties properties, Collection<Path> testPaths, int bytesPerFile,
      Collection<Path> providedPaths,
      Class<? extends InputFormat> inputFormatClass,
      Map<Path, ContentSummary> cache) throws IOException {

    final FileSystem fs = FileSystem.getLocal(jobConf);

    MapWork mapWork = new MapWork();
    Context context = new Context(jobConf);

    for (Map.Entry<Path, ContentSummary> entry : cache.entrySet()) {
      final Path partitionPath = new Path(TEST_TABLE_PATH, entry.getKey());
      context.addCS(partitionPath.toString(), entry.getValue());
    }

    Map<Path, PartitionDesc> pathToPartitionInfo = new LinkedHashMap<>();
    Map<Path, List<String>> pathToAliasTable = new LinkedHashMap<>();
    TableScanOperator scanOp = new TableScanOperator();

    PartitionDesc partitionDesc = new PartitionDesc(
        new TableDesc(inputFormatClass, null, properties), null);

    for (final Path path : testPaths) {
      final Path fullPath = new Path(TEST_TABLE_PATH, path);
      final Path partitionPath = fullPath.getParent();

      // If it is not provided by the test case, create a dummy file
      if (!providedPaths.contains(path)) {
        final byte[] data = new byte[bytesPerFile];

        fs.mkdirs(partitionPath);

        FSDataOutputStream out = fs.create(fullPath);
        out.write(data);
        out.close();
      }

      pathToPartitionInfo.put(partitionPath, partitionDesc);
      pathToAliasTable.put(partitionPath,
          Lists.newArrayList(partitionPath.getName()));
      mapWork.getAliasToWork().put(partitionPath.getName(), scanOp);
    }

    mapWork.setPathToAliases(pathToAliasTable);
    mapWork.setPathToPartitionInfo(pathToPartitionInfo);

    return Utilities.getInputSummary(context, mapWork, null);
  }
Read several files so that their information is cached, then delete those
files and read them again to see if the results were cached from the first
read. If the cache is not working, the sizes will be off since the files no
longer exist in the file system.

@throws Exception e
ql/src/test/org/apache/hadoop/hive/ql/exec/TestGetInputSummary.java