You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2010/10/21 18:56:23 UTC

svn commit: r1026065 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java

Author: namit
Date: Thu Oct 21 16:56:23 2010
New Revision: 1026065

URL: http://svn.apache.org/viewvc?rev=1026065&view=rev
Log:
HIVE-1737. Bug in computing row size for map side hash table in group by
(Siying Dong via Namit Jain)


Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=1026065&r1=1026064&r2=1026065&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Thu Oct 21 16:56:23 2010
@@ -394,6 +394,9 @@ Trunk -  Unreleased
     HIVE-1633. CombineHiveInputFormat fails with "cannot find dir for emptyFile"
     (Sreekanth Ramakrishnan via He Yongqiang)
 
+    HIVE-1737. Bug in computing row size for map side hash table in group by
+    (Siying Dong via Namit Jain)
+
   TESTS
 
     HIVE-1464. improve  test query performance

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java?rev=1026065&r1=1026064&r2=1026065&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java Thu Oct 21 16:56:23 2010
@@ -40,6 +40,8 @@ import org.apache.hadoop.hive.ql.plan.Gr
 import org.apache.hadoop.hive.ql.plan.api.OperatorType;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer;
+import org.apache.hadoop.hive.serde2.lazy.LazyPrimitive;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyStringObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
@@ -753,7 +755,11 @@ public class GroupByOperator extends Ope
         Object key = newKeys.get(pos.intValue());
         // Ignore nulls
         if (key != null) {
-          if (key instanceof String) {
+          if (key instanceof LazyPrimitive) {
+              totalVariableSize +=
+                  ((LazyPrimitive<LazyStringObjectInspector, Text>) key).
+                      getWritableObject().getLength();
+          } else if (key instanceof String) {
             totalVariableSize += ((String) key).length();
           } else if (key instanceof Text) {
             totalVariableSize += ((Text) key).getLength();
@@ -763,7 +769,9 @@ public class GroupByOperator extends Ope
 
       AggregationBuffer[] aggs = null;
       if (aggrPositions.size() > 0) {
-        aggs = hashAggregations.get(newKeys);
+	KeyWrapper newKeyProber = new KeyWrapper(
+	    newKeys.hashCode(), newKeys);
+        aggs = hashAggregations.get(newKeyProber);
       }
 
       for (varLenFields v : aggrPositions) {