public static void inferAndSetPrimaryKey(long numRows, List<ColStatistics> colStats) {
    if (colStats != null) {
      for (ColStatistics cs : colStats) {
        if (cs != null && cs.getCountDistint() >= numRows) {
          cs.setPrimaryKey(true);
        }
        else if (cs != null && cs.getRange() != null && cs.getRange().minValue != null &&
            cs.getRange().maxValue != null) {
          if (numRows ==
              ((cs.getRange().maxValue.longValue() - cs.getRange().minValue.longValue()) + 1)) {
            cs.setPrimaryKey(true);
          }
        }
      }
    }
  }
Based on the provided column statistics and number of rows, this method infers if the column
can be primary key. It checks if the difference between the min and max value is equal to
number of rows specified.
@param numRows - number of rows
@param colStats - column statistics
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java