private static void setFactorJoinKeys(
          HiveLoptMultiJoin multiJoin,
          List<RexNode> filters,
          ImmutableBitSet joinFactors,
          int factorStart,
          int nFields,
          ImmutableBitSet.Builder joinKeys) {
    for (RexNode joinFilter : filters) {
      ImmutableBitSet filterFactors =
              multiJoin.getFactorsRefByJoinFilter(joinFilter);

      // if all factors in the join filter are in the bitmap containing
      // the factors in a join tree, then from that filter, add the
      // fields corresponding to the specified factor to the join key
      // bitmap; in doing so, adjust the join keys so they start at
      // offset 0
      if (joinFactors.contains(filterFactors)) {
        ImmutableBitSet joinFields =
                multiJoin.getFieldsRefByJoinFilter(joinFilter);
        for (int field = joinFields.nextSetBit(factorStart);
             (field >= 0)
                     && (field < (factorStart + nFields));
             field = joinFields.nextSetBit(field + 1)) {
          joinKeys.set(field - factorStart);
        }
      }
    }
  }
Locates from a list of filters those that correspond to a particular join
tree. Then, for each of those filters, extracts the fields corresponding
to a particular factor, setting them in a bitmap.

@param multiJoin join factors being optimized
@param filters list of join filters
@param joinFactors bitmap containing the factors in a particular join
tree
@param factorStart the initial offset of the factor whose join keys will
be extracted
@param nFields the number of fields in the factor whose join keys will be
extracted
@param joinKeys the bitmap that will be set with the join keys
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveLoptOptimizeJoinRule.java