Index: ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java (revision 915695) +++ ql/src/java/org/apache/hadoop/hive/ql/exec/Operator.java (working copy) @@ -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);