public static int getNDVPartitionColumn(PartitionIterable partitions, String partColName) {
    Set<String> distinctVals = new HashSet<>();
    for (Partition partition : partitions) {
      distinctVals.add(partition.getSpec().get(partColName));
    }
    return distinctVals.size();
  }
Scale selectivity based on key range ratio.
@param csPK - column statistics of primary key
@param csFK - column statistics of potential foreign key
@return
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java