diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java index 15958d5e8d..4c5695c68a 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java @@ -1775,20 +1775,11 @@ public Object process(Node nd, Stack stack, NodeProcessorCtx procCtx, if (numAttr > 1 && conf.getBoolVar(HiveConf.ConfVars.HIVE_STATS_CORRELATED_MULTI_KEY_JOINS)) { denom = Collections.max(distinctVals); denomUnmatched = denom - ndvsUnmatched.get(distinctVals.indexOf(denom)); - } else if (numAttr > numParent) { + } else { // To avoid denominator getting larger and aggressively reducing // number of rows, we will ease out denominator. denom = StatsUtils.addWithExpDecay(distinctVals); denomUnmatched = denom - StatsUtils.addWithExpDecay(ndvsUnmatched); - } else { - for (Long l : distinctVals) { - denom = StatsUtils.safeMult(denom, l); - } - long tempDenom = 1; - for (Long l : ndvsUnmatched) { - tempDenom = StatsUtils.safeMult(tempDenom, l); - } - denomUnmatched = denom - tempDenom; } } diff --git a/ql/src/test/results/clientpositive/correlated_join_keys.q.out b/ql/src/test/results/clientpositive/correlated_join_keys.q.out index 1e4c67ad8a..c0a77098b8 100644 --- a/ql/src/test/results/clientpositive/correlated_join_keys.q.out +++ b/ql/src/test/results/clientpositive/correlated_join_keys.q.out @@ -120,7 +120,7 @@ STAGE PLANS: keys: 0 _col0 (type: string), _col1 (type: string) 1 _col0 (type: string), _col1 (type: string) - Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE + Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE Group By Operator aggregations: count() mode: hash