private static Set<ImmutableBitSet> getUniqueKeys(HiveAggregate rel) {
    // group by keys form a unique key
    return ImmutableSet.of(rel.getGroupSet());
  }
EstimateUniqueKeys provides an ability to estimate unique keys based on statistics.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/EstimateUniqueKeys.java