Repository: hive
Updated Branches:
  refs/heads/master 7690dea1b -> 5421c2288


HIVE-13089: Rounding in Stats for equality expressions (Jesus Camacho 
Rodriguez, reviewed by Prasanth Jayachandran)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/5421c228
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/5421c228
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/5421c228

Branch: refs/heads/master
Commit: 5421c2288691bd850766be250fad04a097769bd6
Parents: 7690dea
Author: Jesus Camacho Rodriguez <jcama...@apache.org>
Authored: Sun Feb 21 12:04:58 2016 +0100
Committer: Jesus Camacho Rodriguez <jcama...@apache.org>
Committed: Sun Feb 21 12:21:32 2016 +0100

----------------------------------------------------------------------
 .../ql/optimizer/stats/annotation/StatsRulesProcFactory.java   | 4 ++--
 .../results/clientpositive/annotate_stats_deep_filters.q.out   | 4 ++--
 ql/src/test/results/clientpositive/tez/explainuser_1.q.out     | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/5421c228/ql/src/java/org/apache/hadoop/hive/ql/optimizer/stats/annotation/StatsRulesProcFactory.java
----------------------------------------------------------------------
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 1d3a90a..f273d25 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
@@ -549,7 +549,7 @@ public class StatsRulesProcFactory {
               ColStatistics cs = stats.getColumnStatisticsFromColName(colName);
               if (cs != null) {
                 long dvs = cs.getCountDistint();
-                numRows = dvs == 0 ? numRows / 2 : numRows / dvs;
+                numRows = dvs == 0 ? numRows / 2 : Math.round( (double)numRows 
/ dvs);
                 return numRows;
               }
             } else if (leaf instanceof ExprNodeColumnDesc) {
@@ -569,7 +569,7 @@ public class StatsRulesProcFactory {
                 ColStatistics cs = 
stats.getColumnStatisticsFromColName(colName);
                 if (cs != null) {
                   long dvs = cs.getCountDistint();
-                  numRows = dvs == 0 ? numRows / 2 : numRows / dvs;
+                  numRows = dvs == 0 ? numRows / 2 : Math.round( 
(double)numRows / dvs);
                   return numRows;
                 }
               }

http://git-wip-us.apache.org/repos/asf/hive/blob/5421c228/ql/src/test/results/clientpositive/annotate_stats_deep_filters.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/annotate_stats_deep_filters.q.out 
b/ql/src/test/results/clientpositive/annotate_stats_deep_filters.q.out
index 381346a..b7a87fd 100644
--- a/ql/src/test/results/clientpositive/annotate_stats_deep_filters.q.out
+++ b/ql/src/test/results/clientpositive/annotate_stats_deep_filters.q.out
@@ -121,9 +121,9 @@ STAGE PLANS:
             Statistics: Num rows: 2098 Data size: 16736 Basic stats: COMPLETE 
Column stats: COMPLETE
             Filter Operator
               predicate: (((t = 1) and (si = 2)) or ((t = 2) and (si = 3)) or 
((t = 3) and (si = 4)) or ((t = 4) and (si = 5)) or ((t = 5) and (si = 6)) or 
((t = 6) and (si = 7)) or ((t = 7) and (si = 8)) or ((t = 9) and (si = 10)) or 
((t = 10) and (si = 11)) or ((t = 11) and (si = 12)) or ((t = 12) and (si = 
13)) or ((t = 13) and (si = 14)) or ((t = 14) and (si = 15)) or ((t = 15) and 
(si = 16)) or ((t = 16) and (si = 17)) or ((t = 17) and (si = 18)) or ((t = 27) 
and (si = 28)) or ((t = 37) and (si = 38)) or ((t = 47) and (si = 48)) or ((t = 
52) and (si = 53))) (type: boolean)
-              Statistics: Num rows: 280 Data size: 2232 Basic stats: COMPLETE 
Column stats: COMPLETE
+              Statistics: Num rows: 300 Data size: 2392 Basic stats: COMPLETE 
Column stats: COMPLETE
               Select Operator
-                Statistics: Num rows: 280 Data size: 2232 Basic stats: 
COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 300 Data size: 2392 Basic stats: 
COMPLETE Column stats: COMPLETE
                 Group By Operator
                   aggregations: count()
                   mode: hash

http://git-wip-us.apache.org/repos/asf/hive/blob/5421c228/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/explainuser_1.q.out 
b/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
index 5114076..b95bd0e 100644
--- a/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
+++ b/ql/src/test/results/clientpositive/tez/explainuser_1.q.out
@@ -2127,14 +2127,14 @@ Stage-0
           <-Reducer 2 [SIMPLE_EDGE]
             SHUFFLE [RS_18]
               PartitionCols:_col1
-              Merge Join Operator [MERGEJOIN_31] (rows=12 width=8)
+              Merge Join Operator [MERGEJOIN_31] (rows=13 width=8)
                 Conds:RS_15._col0, _col3=RS_16._col0, _col1(Left 
Semi),Output:["_col1","_col2"]
               <-Map 1 [SIMPLE_EDGE]
                 SHUFFLE [RS_15]
                   PartitionCols:_col0, _col3
-                  Select Operator [SEL_2] (rows=16 width=16)
+                  Select Operator [SEL_2] (rows=17 width=16)
                     Output:["_col0","_col1","_col2","_col3"]
-                    Filter Operator [FIL_28] (rows=16 width=16)
+                    Filter Operator [FIL_28] (rows=17 width=16)
                       predicate:(((l_linenumber = 1) and l_partkey is not 
null) and l_orderkey is not null)
                       TableScan [TS_0] (rows=100 width=16)
                         
default@lineitem,lineitem,Tbl:COMPLETE,Col:COMPLETE,Output:["l_orderkey","l_partkey","l_suppkey","l_linenumber"]

Reply via email to