public String getMappingBigFile(String alias, String smallFile) {
    HashSet<String> bigFiles = new HashSet<String>();
    Map<String, List<String>> mapping = aliasBucketFileNameMapping.get(alias);
    for (Map.Entry<String, List<String>> entry: mapping.entrySet()) {
      if (entry.getValue().contains(smallFile)) {
        bigFiles.add(entry.getKey());
      }
    }
    // There could be several big table input files
    // mapping to the same small input file.
    // Find that one with the lowest bucket id.
    int bucketId = Integer.MAX_VALUE;
    String bigFile = null;
    for (String f: bigFiles) {
      int id = bucketFileNameMapping.get(f);
      if (id < bucketId) {
        bucketId = id;
        bigFile = f;
      }
    }
    return bigFile;
  }
Given a small table input file, find the mapping
big table input file with the smallest bucket number.
ql/src/java/org/apache/hadoop/hive/ql/plan/BucketMapJoinContext.java