private long getDenominatorForUnmatchedRows(List<Long> distinctVals) {

      if (distinctVals.isEmpty()) {
        return 2;
      }

      // simple join from 2 relations: denom = min(v1, v2)
      if (distinctVals.size() <= 2) {
        return Collections.min(distinctVals);
      } else {

        // remember max value and ignore it from the denominator
        long maxNDV = distinctVals.get(0);
        int maxIdx = 0;

        for (int i = 1; i < distinctVals.size(); i++) {
          if (distinctVals.get(i) > maxNDV) {
            maxNDV = distinctVals.get(i);
            maxIdx = i;
          }
        }

        // join from multiple relations:
        // denom = Product of all NDVs except the greatest of all
        long denom = 1;
        for (int i = 0; i < distinctVals.size(); i++) {
          if (i != maxIdx) {
            denom = StatsUtils.safeMult(denom, distinctVals.get(i));
          }
        }
        return denom;
      }
    }
Returns the index of parents whose join key columns are infer as primary keys
@param ops - operators
@return - list of primary key containing parent ids
ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java