public static ImmutableBitSet extractRefs(Aggregate aggregate) {
    final ImmutableBitSet.Builder refs = ImmutableBitSet.builder();
    refs.addAll(aggregate.getGroupSet());
    for (AggregateCall aggCall : aggregate.getAggCallList()) {
      refs.addAll(aggCall.getArgList());
      if (aggCall.filterArg != -1) {
        refs.set(aggCall.filterArg);
      }
    }
    return refs.build();
  }
Extracts inputs referenced by aggregate operator.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveCalciteUtil.java