private static boolean isWithin(ColStatistics.Range range1, ColStatistics.Range range2) {
    if (range1.minValue != null && range2.minValue != null && range1.maxValue != null &&
        range2.maxValue != null) {
      if (range1.minValue.longValue() >= range2.minValue.longValue() &&
          range1.maxValue.longValue() <= range2.maxValue.longValue()) {
        return true;
      }
    }
    return false;
  }
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