@Test
  public void testGetInputSummaryPoolWithCacheReuse() throws Exception {
    final int BYTES_PER_FILE = 5;

    final Collection<Path> testPaths1 = Arrays.asList(new Path("p1/test.txt"),
        new Path("p2/test.txt"), new Path("p3/test.txt"));
    final Collection<Path> testPaths2 =
        Arrays.asList(new Path("p4/test.txt"), new Path("p5/test.txt"));

    jobConf.setInt(
        HiveConf.ConfVars.HIVE_EXEC_INPUT_LISTING_MAX_THREADS.varname, 0);

    ContentSummary summary =
        runTestGetInputSummary(jobConf, properties, testPaths1, BYTES_PER_FILE,
            HiveInputFormat.class, Collections.emptyMap());

    // Ensure the first group of files were read correctly
    assertEquals(testPaths1.size() * BYTES_PER_FILE, summary.getLength());
    assertEquals(testPaths1.size(), summary.getFileCount());
    assertEquals(testPaths1.size(), summary.getDirectoryCount());

    // Delete the files from the first group
    final FileSystem fs = FileSystem.getLocal(jobConf);
    for (final Path path : testPaths1) {
      fs.delete(path, true);
    }

    // Read all the files and the first group's stats should be pulled from
    // cache and the second group from the file system
    summary = runTestGetInputSummary(jobConf, properties,
        CollectionUtils.union(testPaths1, testPaths2), BYTES_PER_FILE,
        new HashSet<>(testPaths1), HiveInputFormat.class,
        Collections.emptyMap());

    assertEquals((testPaths1.size() + testPaths2.size()) * BYTES_PER_FILE,
        summary.getLength());
    assertEquals((testPaths1.size() + testPaths2.size()),
        summary.getFileCount());
    assertEquals((testPaths1.size() + testPaths2.size()),
        summary.getDirectoryCount());
  }
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