public static List<HadoopShims.HdfsFileStatusWithId> tryListLocatedHdfsStatus(Ref<Boolean> useFileIds, FileSystem fs,
      Path directory, PathFilter filter) {
    if (useFileIds == null) {
      return null;
    }
    if (filter == null) {
      filter = FileUtils.HIDDEN_FILES_PATH_FILTER;
    }

    List<HadoopShims.HdfsFileStatusWithId> childrenWithId = null;
    final Boolean val = useFileIds.value;
    if (val == null || val) {
      try {
        childrenWithId = SHIMS.listLocatedHdfsStatus(fs, directory, filter);
        if (val == null) {
          useFileIds.value = true;
        }
      } catch (UnsupportedOperationException uoe) {
        LOG.info("Failed to get files with ID; using regular API: " + uoe.getMessage());
        if (val == null) {
          useFileIds.value = false;
        }
      } catch (IOException ioe) {
        LOG.info("Failed to get files with ID; using regular API: " + ioe.getMessage());
        LOG.debug("Failed to get files with ID", ioe);
      }
    }
    return childrenWithId;
  }
List files recursively in the given directory.
If the filesystem supports it will use file listing with FileIds.
@param fs the filesystem
@param dir the directory to list
@param useFileIds use fileId if possible
@param recursive do recursive listing
@param filter filter to apply
@return List of files
@throws IOException ex
ql/src/java/org/apache/hadoop/hive/ql/io/HdfsUtils.java