hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jd...@apache.org
Subject [35/50] [abbrv] hive git commit: HIVE-13021: GenericUDAFEvaluator.isEstimable(agg) always returns false (addendum)
Date Tue, 23 Feb 2016 19:17:34 GMT
HIVE-13021: GenericUDAFEvaluator.isEstimable(agg) always returns false (addendum)

Signed-off-by: Gopal V <gopalv@apache.org>


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

Branch: refs/heads/llap
Commit: 864958f8fcd76e3834157ee46826be07add04e15
Parents: 0aa1bdd
Author: Gopal V <gopalv@apache.org>
Authored: Fri Feb 19 21:13:23 2016 -0800
Committer: Gopal V <gopalv@apache.org>
Committed: Fri Feb 19 21:13:23 2016 -0800

----------------------------------------------------------------------
 .../hive/ql/udf/generic/GenericUDAFComputeStats.java    | 12 +++++++++---
 .../hive/ql/udf/generic/NumDistinctValueEstimator.java  | 12 ++++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/864958f8/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFComputeStats.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFComputeStats.java
b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFComputeStats.java
index d6ca73f..57e8b62 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFComputeStats.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFComputeStats.java
@@ -431,8 +431,11 @@ public class GenericUDAFComputeStats extends AbstractGenericUDAFResolver
{
       @Override
       public int estimate() {
         JavaDataModel model = JavaDataModel.get();
-        return model.lengthFor(columnType) + model.primitive1() + model.primitive2() +
-            numDV.lengthFor(model);
+        return model.lengthFor(columnType)
+            + model.primitive1()
+            + model.primitive2()
+            + ((numDV == null) ? NumDistinctValueEstimator.lengthFor(model, null) :
+                                 numDV.lengthFor(model));
       }
 
       protected void initNDVEstimator(int numBitVectors) {
@@ -836,7 +839,10 @@ public class GenericUDAFComputeStats extends AbstractGenericUDAFResolver
{
       public int estimate() {
         JavaDataModel model = JavaDataModel.get();
         return model.primitive1() * 2 + model.primitive2() * 4 +
-            model.lengthFor(columnType) + numDV.lengthFor(model);
+            model.lengthFor(columnType) +
+            ((numDV == null) ? NumDistinctValueEstimator.lengthFor(model, null) :
+                               numDV.lengthFor(model));
+
       }
     };
 

http://git-wip-us.apache.org/repos/asf/hive/blob/864958f8/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NumDistinctValueEstimator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NumDistinctValueEstimator.java
b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NumDistinctValueEstimator.java
index 99f4d71..fa70f49 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NumDistinctValueEstimator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NumDistinctValueEstimator.java
@@ -22,6 +22,7 @@ import javolution.util.FastBitSet;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.hadoop.hive.common.classification.InterfaceAudience;
 import org.apache.hadoop.hive.common.type.HiveDecimal;
 import org.apache.hadoop.hive.ql.util.JavaDataModel;
 import org.apache.hadoop.io.Text;
@@ -356,13 +357,17 @@ public class NumDistinctValueEstimator {
     return ((long)(numDistinctValues));
   }
 
-  public int lengthFor(JavaDataModel model) {
+  @InterfaceAudience.LimitedPrivate(value = { "Hive" })
+  static int lengthFor(JavaDataModel model, Integer numVector) {
     int length = model.object();
     length += model.primitive1() * 2;       // two int
     length += model.primitive2();           // one double
     length += model.lengthForRandom() * 2;  // two Random
 
-    int numVector = getnumBitVectors();
+    if (numVector == null) {
+      numVector = 16; // HiveConf hive.stats.ndv.error default produces 16 vectors
+    }
+
     if (numVector > 0) {
       length += model.array() * 3;                    // three array
       length += model.primitive1() * numVector * 2;   // two int array
@@ -372,4 +377,7 @@ public class NumDistinctValueEstimator {
     return length;
   }
 
+  public int lengthFor(JavaDataModel model) {
+    return lengthFor(model, getnumBitVectors());
+  }
 }


Mime
View raw message