private Map<Integer, List<Reader>> getBucketFiles(HiveConf conf, Path dirPath, boolean isMm) throws IOException {
    Map<Integer, List<Reader>> bucketIdToBucketFilePath = new HashMap<>();
    FileSystem fs = dirPath.getFileSystem(conf);
    FileStatus[] fileStatuses =
            fs.listStatus(dirPath, isMm ? AcidUtils.originalBucketFilter : AcidUtils.bucketFileFilter);
    for (FileStatus f : fileStatuses) {
      final Path fPath = f.getPath();
      Matcher matcher = isMm ? AcidUtils.LEGACY_BUCKET_DIGIT_PATTERN
              .matcher(fPath.getName()) : AcidUtils.BUCKET_PATTERN.matcher(fPath.getName());
      if (!matcher.find()) {
        String errorMessage = String
                .format("Found a bucket file which did not match the bucket pattern! %s Matcher=%s", fPath,
                        matcher);
        LOG.error(errorMessage);
        throw new IllegalArgumentException(errorMessage);
      }
      int bucketNum = matcher.groupCount() > 0 ? Integer.parseInt(matcher.group(1)) : Integer.parseInt(matcher.group());
      bucketIdToBucketFilePath.computeIfAbsent(bucketNum, ArrayList::new);
      Reader reader = OrcFile.createReader(fs, fPath);
      bucketIdToBucketFilePath.computeIfPresent(bucketNum, (k, v) -> v).add(reader);
    }
    return bucketIdToBucketFilePath;
  }
Collect the list of all bucket file paths, which belong to the same bucket Id. This method checks only one
directory.
@param conf hive configuration, must be not null
@param dirPath the directory to be scanned.
@param isMm collect bucket files fron insert only directories
@throws IOException an error happened during the reading of the directory/bucket file
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/MergeCompactor.java