@Override
  public ContentSummary getContentSummary(Path p, JobConf job)
      throws IOException {
    //length, file count, directory count
    long[] summary = {0, 0, 0};
    List<Path> targetPaths = new ArrayList<Path>();
    List<Path> symlinkPaths = new ArrayList<Path>();
    try {
      getTargetPathsFromSymlinksDirs(
          job,
          new Path[]{p},
          targetPaths,
          symlinkPaths);
    } catch (Exception e) {
      throw new IOException(
          "Error parsing symlinks from specified job input path.", e);
    }
    for(Path path : targetPaths) {
      FileSystem fs = path.getFileSystem(job);
      ContentSummary cs = fs.getContentSummary(path);
      summary[0] += cs.getLength();
      summary[1] += cs.getFileCount();
      summary[2] += cs.getDirectoryCount();
    }
    return new ContentSummary(summary[0], summary[1], summary[2]);
  }
Given list of directories containing symlink files, read all target
paths from symlink files and return as targetPaths list. And for each
targetPaths[i], symlinkPaths[i] will be the path to the symlink file
containing the target path.
ql/src/java/org/apache/hadoop/hive/ql/io/SymlinkTextInputFormat.java