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

svn commit: r916124 - in /hadoop/hive/branches/branch-0.5: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java

Author: nzhang
Date: Thu Feb 25 04:56:10 2010
New Revision: 916124

URL: http://svn.apache.org/viewvc?rev=916124&view=rev
Log:
HIVE-1195. Increase ObjectInspector[] length on demand

Modified:
    hadoop/hive/branches/branch-0.5/CHANGES.txt
    hadoop/hive/branches/branch-0.5/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java

Modified: hadoop/hive/branches/branch-0.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.5/CHANGES.txt?rev=916124&r1=916123&r2=916124&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.5/CHANGES.txt (original)
+++ hadoop/hive/branches/branch-0.5/CHANGES.txt Thu Feb 25 04:56:10 2010
@@ -11,6 +11,9 @@
     HIVE-1190. Configure build to download Hadoop tarballs from Facebook mirror.
     (John Sichi via zshao)
 
+    HIVE-1195. Increase ObjectInspector[] length on demand
+    (Zheng Shao via Ning Zhang)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/hive/branches/branch-0.5/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java
URL: http://svn.apache.org/viewvc/hadoop/hive/branches/branch-0.5/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java?rev=916124&r1=916123&r2=916124&view=diff
==============================================================================
--- hadoop/hive/branches/branch-0.5/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java (original)
+++ hadoop/hive/branches/branch-0.5/ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java Thu Feb 25 04:56:10 2010
@@ -185,7 +185,8 @@
   transient protected Reporter reporter;
   transient protected String id;
   // object inspectors for input rows
-  transient protected ObjectInspector[] inputObjInspectors = new ObjectInspector[Short.MAX_VALUE];
+  // We will increase the size of the array on demand
+  transient protected ObjectInspector[] inputObjInspectors = new ObjectInspector[1];
   // for output rows of this operator
   transient protected ObjectInspector outputObjInspector;
 
@@ -359,6 +360,14 @@
    */
   private void initialize(Configuration hconf, ObjectInspector inputOI, int parentId) throws HiveException {
     LOG.info("Initializing child " + id + " " + getName());
+    // Double the size of the array if needed
+    if (parentId >= inputObjInspectors.length) {
+      int newLength = inputObjInspectors.length * 2;
+      while (parentId >= newLength) {
+        newLength *= 2;
+      }
+      inputObjInspectors = Arrays.copyOf(inputObjInspectors, newLength);
+    }
     inputObjInspectors[parentId] = inputOI;
     // call the actual operator initialization function
     initialize(hconf, null);