Author: rhbutani
Date: Tue Apr 1 21:31:06 2014
New Revision: 1583798
URL: http://svn.apache.org/r1583798
Log:
HIVE-6797 Add protection against divide by zero in stats annotation (Prasanth J
via Harish Butani)
Modified:
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java
Modified:
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java
URL:
http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java?rev=1583798&r1=1583797&r2=1583798&view=diff
==============================================================================
---
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java
(original)
+++
hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java
Tue Apr 1 21:31:06 2014
@@ -1115,7 +1115,7 @@ public class StatsRulesProcFactory {
// number of distincts should not change. Update the distinct count
only when
// the output number of rows is less than input number of rows.
if (ratio <= 1.0) {
- newDV = Math.round(ratio * oldDV);
+ newDV = (long) Math.ceil(ratio * oldDV);
}
cs.setNumNulls(newNumNulls);
cs.setCountDistint(newDV);