hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [06/51] [partial] hive git commit: Revert "HIVE-14671 : merge master into hive-14535 (Wei Zheng)"
Date Mon, 08 May 2017 20:42:56 GMT
http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorHashKeyWrapperBatch.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorHashKeyWrapperBatch.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorHashKeyWrapperBatch.java
index 82e8748..f68228c 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorHashKeyWrapperBatch.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorHashKeyWrapperBatch.java
@@ -18,15 +18,11 @@
 
 package org.apache.hadoop.hive.ql.exec.vector;
 
-import org.apache.hadoop.hive.ql.exec.vector.VectorHashKeyWrapper.EmptyVectorHashKeyWrapper;
 import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
 import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpressionWriter;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.util.JavaDataModel;
 import org.apache.hadoop.hive.serde2.io.TimestampWritable;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
-import org.apache.hadoop.hive.ql.exec.vector.ColumnVector.Type;
 
 /**
  * Class for handling vectorized hash map key wrappers. It evaluates the key columns in a
@@ -63,11 +59,6 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    */
   private int keysFixedSize;
 
-  /**
-   * Shared hashcontext for all keys in this batch
-   */
-  private final VectorHashKeyWrapper.HashContext hashCtx = new VectorHashKeyWrapper.HashContext();
-
    /**
    * Returns the compiled fixed size for the key wrappers.
    * @return
@@ -94,21 +85,12 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * @throws HiveException
    */
   public void evaluateBatch(VectorizedRowBatch batch) throws HiveException {
-
-    if (keyCount == 0) {
-      // all keywrappers must be EmptyVectorHashKeyWrapper
-      return;
+    for(int i = 0; i < keyExpressions.length; ++i) {
+      keyExpressions[i].evaluate(batch);
     }
-
-    for(int i=0;i<batch.size;++i) {
-      vectorHashKeyWrappers[i].clearIsNull();
-    }
-
-    int keyIndex;
-    int columnIndex;
     for(int i = 0; i< longIndices.length; ++i) {
-      keyIndex = longIndices[i];
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
+      int keyIndex = longIndices[i];
+      int columnIndex = keyExpressions[keyIndex].getOutputColumn();
       LongColumnVector columnVector = (LongColumnVector) batch.cols[columnIndex];
       if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
         assignLongNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
@@ -117,11 +99,11 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       } else if (columnVector.noNulls && columnVector.isRepeating) {
         assignLongNoNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignLongNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
+        assignLongNullsNoRepeatingNoSelection(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignLongNullsRepeating(keyIndex, i, batch.size, columnVector);
+        assignLongNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignLongNullsNoRepeatingSelection (keyIndex, i, batch.size, columnVector, batch.selected);
+        assignLongNullsNoRepeatingSelection (i, batch.size, columnVector, batch.selected);
       } else {
         throw new HiveException (String.format(
             "Unimplemented Long null/repeat/selected combination %b/%b/%b",
@@ -129,8 +111,8 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       }
     }
     for(int i=0;i<doubleIndices.length; ++i) {
-      keyIndex = doubleIndices[i];
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
+      int keyIndex = doubleIndices[i];
+      int columnIndex = keyExpressions[keyIndex].getOutputColumn();
       DoubleColumnVector columnVector = (DoubleColumnVector) batch.cols[columnIndex];
       if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
         assignDoubleNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
@@ -139,11 +121,11 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       } else if (columnVector.noNulls && columnVector.isRepeating) {
         assignDoubleNoNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignDoubleNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
+        assignDoubleNullsNoRepeatingNoSelection(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignDoubleNullsRepeating(keyIndex, i, batch.size, columnVector);
+        assignDoubleNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignDoubleNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
+        assignDoubleNullsNoRepeatingSelection (i, batch.size, columnVector, batch.selected);
       } else {
         throw new HiveException (String.format(
             "Unimplemented Double null/repeat/selected combination %b/%b/%b",
@@ -151,8 +133,8 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       }
     }
     for(int i=0;i<stringIndices.length; ++i) {
-      keyIndex = stringIndices[i];
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
+      int keyIndex = stringIndices[i];
+      int columnIndex = keyExpressions[keyIndex].getOutputColumn();
       BytesColumnVector columnVector = (BytesColumnVector) batch.cols[columnIndex];
       if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
         assignStringNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
@@ -161,11 +143,11 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       } else if (columnVector.noNulls && columnVector.isRepeating) {
         assignStringNoNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignStringNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
+        assignStringNullsNoRepeatingNoSelection(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignStringNullsRepeating(keyIndex, i, batch.size, columnVector);
+        assignStringNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignStringNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
+        assignStringNullsNoRepeatingSelection (i, batch.size, columnVector, batch.selected);
       } else {
         throw new HiveException (String.format(
             "Unimplemented String null/repeat/selected combination %b/%b/%b",
@@ -173,8 +155,8 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       }
     }
     for(int i=0;i<decimalIndices.length; ++i) {
-      keyIndex = decimalIndices[i];
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
+      int keyIndex = decimalIndices[i];
+      int columnIndex = keyExpressions[keyIndex].getOutputColumn();
       DecimalColumnVector columnVector = (DecimalColumnVector) batch.cols[columnIndex];
       if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
         assignDecimalNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
@@ -183,11 +165,11 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       } else if (columnVector.noNulls && columnVector.isRepeating) {
         assignDecimalNoNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignDecimalNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
+        assignDecimalNullsNoRepeatingNoSelection(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignDecimalNullsRepeating(keyIndex, i, batch.size, columnVector);
+        assignDecimalNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignDecimalNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
+        assignDecimalNullsNoRepeatingSelection (i, batch.size, columnVector, batch.selected);
       } else {
         throw new HiveException (String.format(
             "Unimplemented Decimal null/repeat/selected combination %b/%b/%b",
@@ -195,8 +177,8 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       }
     }
     for(int i=0;i<timestampIndices.length; ++i) {
-      keyIndex = timestampIndices[i];
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
+      int keyIndex = timestampIndices[i];
+      int columnIndex = keyExpressions[keyIndex].getOutputColumn();
       TimestampColumnVector columnVector = (TimestampColumnVector) batch.cols[columnIndex];
       if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
         assignTimestampNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
@@ -205,11 +187,11 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       } else if (columnVector.noNulls && columnVector.isRepeating) {
         assignTimestampNoNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignTimestampNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
+        assignTimestampNullsNoRepeatingNoSelection(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignTimestampNullsRepeating(keyIndex, i, batch.size, columnVector);
+        assignTimestampNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignTimestampNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
+        assignTimestampNullsNoRepeatingSelection (i, batch.size, columnVector, batch.selected);
       } else {
         throw new HiveException (String.format(
             "Unimplemented timestamp null/repeat/selected combination %b/%b/%b",
@@ -217,8 +199,8 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       }
     }
     for(int i=0;i<intervalDayTimeIndices.length; ++i) {
-      keyIndex = intervalDayTimeIndices[i];
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
+      int keyIndex = intervalDayTimeIndices[i];
+      int columnIndex = keyExpressions[keyIndex].getOutputColumn();
       IntervalDayTimeColumnVector columnVector = (IntervalDayTimeColumnVector) batch.cols[columnIndex];
       if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
         assignIntervalDayTimeNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
@@ -227,198 +209,11 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       } else if (columnVector.noNulls && columnVector.isRepeating) {
         assignIntervalDayTimeNoNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignIntervalDayTimeNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
+        assignIntervalDayTimeNullsNoRepeatingNoSelection(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignIntervalDayTimeNullsRepeating(keyIndex, i, batch.size, columnVector);
+        assignIntervalDayTimeNullsRepeating(i, batch.size, columnVector);
       } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignIntervalDayTimeNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
-      } else {
-        throw new HiveException (String.format(
-            "Unimplemented intervalDayTime null/repeat/selected combination %b/%b/%b",
-            columnVector.noNulls, columnVector.isRepeating, batch.selectedInUse));
-      }
-    }
-    for(int i=0;i<batch.size;++i) {
-      vectorHashKeyWrappers[i].setHashKey();
-    }
-  }
-
-  public void evaluateBatchGroupingSets(VectorizedRowBatch batch,
-      boolean[] groupingSetsOverrideIsNulls) throws HiveException {
-
-    for(int i=0;i<batch.size;++i) {
-      vectorHashKeyWrappers[i].clearIsNull();
-    }
-    int keyIndex;
-    int columnIndex;
-    for(int i = 0; i< longIndices.length; ++i) {
-      keyIndex = longIndices[i];
-      if (groupingSetsOverrideIsNulls[keyIndex]) {
-        final int batchSize = batch.size;
-        for(int r = 0; r < batchSize; ++r) {
-          vectorHashKeyWrappers[r].assignNullLong(keyIndex, i);
-        }
-        continue;
-      }
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
-      LongColumnVector columnVector = (LongColumnVector) batch.cols[columnIndex];
-      if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignLongNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
-      } else if (columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignLongNoNullsNoRepeatingSelection(i, batch.size, columnVector, batch.selected);
-      } else if (columnVector.noNulls && columnVector.isRepeating) {
-        assignLongNoNullsRepeating(i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignLongNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignLongNullsRepeating(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignLongNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
-      } else {
-        throw new HiveException (String.format(
-            "Unimplemented Long null/repeat/selected combination %b/%b/%b",
-            columnVector.noNulls, columnVector.isRepeating, batch.selectedInUse));
-      }
-    }
-    for(int i=0;i<doubleIndices.length; ++i) {
-      keyIndex = doubleIndices[i];
-      if (groupingSetsOverrideIsNulls[keyIndex]) {
-        final int batchSize = batch.size;
-        for(int r = 0; r < batchSize; ++r) {
-          vectorHashKeyWrappers[r].assignNullDouble(keyIndex, i);
-        }
-        continue;
-      }
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
-      DoubleColumnVector columnVector = (DoubleColumnVector) batch.cols[columnIndex];
-      if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignDoubleNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
-      } else if (columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignDoubleNoNullsNoRepeatingSelection(i, batch.size, columnVector, batch.selected);
-      } else if (columnVector.noNulls && columnVector.isRepeating) {
-        assignDoubleNoNullsRepeating(i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignDoubleNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignDoubleNullsRepeating(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignDoubleNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
-      } else {
-        throw new HiveException (String.format(
-            "Unimplemented Double null/repeat/selected combination %b/%b/%b",
-            columnVector.noNulls, columnVector.isRepeating, batch.selectedInUse));
-      }
-    }
-    for(int i=0;i<stringIndices.length; ++i) {
-      keyIndex = stringIndices[i];
-      if (groupingSetsOverrideIsNulls[keyIndex]) {
-        final int batchSize = batch.size;
-        for(int r = 0; r < batchSize; ++r) {
-          vectorHashKeyWrappers[r].assignNullString(keyIndex, i);
-        }
-        continue;
-      }
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
-      BytesColumnVector columnVector = (BytesColumnVector) batch.cols[columnIndex];
-      if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignStringNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
-      } else if (columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignStringNoNullsNoRepeatingSelection(i, batch.size, columnVector, batch.selected);
-      } else if (columnVector.noNulls && columnVector.isRepeating) {
-        assignStringNoNullsRepeating(i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignStringNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignStringNullsRepeating(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignStringNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
-      } else {
-        throw new HiveException (String.format(
-            "Unimplemented String null/repeat/selected combination %b/%b/%b",
-            columnVector.noNulls, columnVector.isRepeating, batch.selectedInUse));
-      }
-    }
-    for(int i=0;i<decimalIndices.length; ++i) {
-      keyIndex = decimalIndices[i];
-      if (groupingSetsOverrideIsNulls[keyIndex]) {
-        final int batchSize = batch.size;
-        for(int r = 0; r < batchSize; ++r) {
-          vectorHashKeyWrappers[r].assignNullDecimal(keyIndex, i);
-        }
-        continue;
-      }
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
-      DecimalColumnVector columnVector = (DecimalColumnVector) batch.cols[columnIndex];
-      if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignDecimalNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
-      } else if (columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignDecimalNoNullsNoRepeatingSelection(i, batch.size, columnVector, batch.selected);
-      } else if (columnVector.noNulls && columnVector.isRepeating) {
-        assignDecimalNoNullsRepeating(i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignDecimalNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignDecimalNullsRepeating(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignDecimalNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
-      } else {
-        throw new HiveException (String.format(
-            "Unimplemented Decimal null/repeat/selected combination %b/%b/%b",
-            columnVector.noNulls, columnVector.isRepeating, batch.selectedInUse));
-      }
-    }
-    for(int i=0;i<timestampIndices.length; ++i) {
-      keyIndex = timestampIndices[i];
-      if (groupingSetsOverrideIsNulls[keyIndex]) {
-        final int batchSize = batch.size;
-        for(int r = 0; r < batchSize; ++r) {
-          vectorHashKeyWrappers[r].assignNullTimestamp(keyIndex, i);
-        }
-        continue;
-      }
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
-      TimestampColumnVector columnVector = (TimestampColumnVector) batch.cols[columnIndex];
-      if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignTimestampNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
-      } else if (columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignTimestampNoNullsNoRepeatingSelection(i, batch.size, columnVector, batch.selected);
-      } else if (columnVector.noNulls && columnVector.isRepeating) {
-        assignTimestampNoNullsRepeating(i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignTimestampNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignTimestampNullsRepeating(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignTimestampNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
-      } else {
-        throw new HiveException (String.format(
-            "Unimplemented timestamp null/repeat/selected combination %b/%b/%b",
-            columnVector.noNulls, columnVector.isRepeating, batch.selectedInUse));
-      }
-    }
-    for(int i=0;i<intervalDayTimeIndices.length; ++i) {
-      keyIndex = intervalDayTimeIndices[i];
-      if (groupingSetsOverrideIsNulls[keyIndex]) {
-        final int batchSize = batch.size;
-        for(int r = 0; r < batchSize; ++r) {
-          vectorHashKeyWrappers[r].assignNullIntervalDayTime(keyIndex, i);
-        }
-        continue;
-      }
-      columnIndex = keyExpressions[keyIndex].getOutputColumn();
-      IntervalDayTimeColumnVector columnVector = (IntervalDayTimeColumnVector) batch.cols[columnIndex];
-      if (columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignIntervalDayTimeNoNullsNoRepeatingNoSelection(i, batch.size, columnVector);
-      } else if (columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignIntervalDayTimeNoNullsNoRepeatingSelection(i, batch.size, columnVector, batch.selected);
-      } else if (columnVector.noNulls && columnVector.isRepeating) {
-        assignIntervalDayTimeNoNullsRepeating(i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && !batch.selectedInUse) {
-        assignIntervalDayTimeNullsNoRepeatingNoSelection(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && columnVector.isRepeating) {
-        assignIntervalDayTimeNullsRepeating(keyIndex, i, batch.size, columnVector);
-      } else if (!columnVector.noNulls && !columnVector.isRepeating && batch.selectedInUse) {
-        assignIntervalDayTimeNullsNoRepeatingSelection(keyIndex, i, batch.size, columnVector, batch.selected);
+        assignIntervalDayTimeNullsNoRepeatingSelection (i, batch.size, columnVector, batch.selected);
       } else {
         throw new HiveException (String.format(
             "Unimplemented intervalDayTime null/repeat/selected combination %b/%b/%b",
@@ -434,15 +229,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for string type, possible nulls, no repeat values, batch selection vector.
    */
-  private void assignStringNullsNoRepeatingSelection(int keyIndex, int index, int size,
+  private void assignStringNullsNoRepeatingSelection(int index, int size,
       BytesColumnVector columnVector, int[] selected) {
     for(int i=0; i<size; ++i) {
       int row = selected[i];
       if (columnVector.isNull[row]) {
-        vectorHashKeyWrappers[i].assignNullString(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullString(index);
       } else {
-        vectorHashKeyWrappers[i].assignString(
-            index,
+        vectorHashKeyWrappers[i].assignString(index,
             columnVector.vector[row],
             columnVector.start[row],
             columnVector.length[row]);
@@ -454,15 +248,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for double type, possible nulls, repeat values.
    */
-  private void assignStringNullsRepeating(int keyIndex, int index, int size, BytesColumnVector columnVector) {
+  private void assignStringNullsRepeating(int index, int size, BytesColumnVector columnVector) {
     if (columnVector.isNull[0]) {
       for(int i = 0; i < size; ++i) {
-        vectorHashKeyWrappers[i].assignNullString(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullString(index);
       }
     } else {
       for(int i = 0; i < size; ++i) {
-        vectorHashKeyWrappers[i].assignString(
-            index,
+        vectorHashKeyWrappers[i].assignString(index,
             columnVector.vector[0],
             columnVector.start[0],
             columnVector.length[0]);
@@ -474,14 +267,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for string type, possible nulls, no repeat values, no selection vector.
    */
-  private void assignStringNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
+  private void assignStringNullsNoRepeatingNoSelection(int index, int size,
       BytesColumnVector columnVector) {
     for(int i=0; i<size; ++i) {
       if (columnVector.isNull[i]) {
-        vectorHashKeyWrappers[i].assignNullString(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullString(index);
       } else {
-        vectorHashKeyWrappers[i].assignString(
-            index,
+        vectorHashKeyWrappers[i].assignString(index,
             columnVector.vector[i],
             columnVector.start[i],
             columnVector.length[i]);
@@ -493,11 +285,9 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for double type, no nulls, repeat values, no selection vector.
    */
-  private void assignStringNoNullsRepeating(int index, int size,
-      BytesColumnVector columnVector) {
+  private void assignStringNoNullsRepeating(int index, int size, BytesColumnVector columnVector) {
     for(int i = 0; i < size; ++i) {
-      vectorHashKeyWrappers[i].assignString(
-          index,
+      vectorHashKeyWrappers[i].assignString(index,
           columnVector.vector[0],
           columnVector.start[0],
           columnVector.length[0]);
@@ -512,8 +302,7 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
       BytesColumnVector columnVector, int[] selected) {
     for(int i=0; i<size; ++i) {
       int row = selected[i];
-      vectorHashKeyWrappers[i].assignString(
-          index,
+      vectorHashKeyWrappers[i].assignString(index,
           columnVector.vector[row],
           columnVector.start[row],
           columnVector.length[row]);
@@ -527,8 +316,7 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
   private void assignStringNoNullsNoRepeatingNoSelection(int index, int size,
       BytesColumnVector columnVector) {
     for(int i=0; i<size; ++i) {
-      vectorHashKeyWrappers[i].assignString(
-          index,
+      vectorHashKeyWrappers[i].assignString(index,
           columnVector.vector[i],
           columnVector.start[i],
           columnVector.length[i]);
@@ -539,14 +327,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for double type, possible nulls, no repeat values, batch selection vector.
    */
-  private void assignDoubleNullsNoRepeatingSelection(int keyIndex, int index, int size,
+  private void assignDoubleNullsNoRepeatingSelection(int index, int size,
       DoubleColumnVector columnVector, int[] selected) {
     for(int i = 0; i < size; ++i) {
       int row = selected[i];
       if (!columnVector.isNull[row]) {
         vectorHashKeyWrappers[i].assignDouble(index, columnVector.vector[row]);
       } else {
-        vectorHashKeyWrappers[i].assignNullDouble(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullDouble(index);
       }
     }
   }
@@ -555,10 +343,10 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Double type, repeat null values.
    */
-  private void assignDoubleNullsRepeating(int keyIndex, int index, int size,
+  private void assignDoubleNullsRepeating(int index, int size,
       DoubleColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
-      vectorHashKeyWrappers[r].assignNullDouble(keyIndex, index);
+      vectorHashKeyWrappers[r].assignNullDouble(index);
     }
   }
 
@@ -566,13 +354,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Double type, possible nulls, repeat values.
    */
-  private void assignDoubleNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
+  private void assignDoubleNullsNoRepeatingNoSelection(int index, int size,
       DoubleColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
       if (!columnVector.isNull[r]) {
         vectorHashKeyWrappers[r].assignDouble(index, columnVector.vector[r]);
       } else {
-        vectorHashKeyWrappers[r].assignNullDouble(keyIndex, index);
+        vectorHashKeyWrappers[r].assignNullDouble(index);
       }
     }
   }
@@ -613,14 +401,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for double type, possible nulls, no repeat values, batch selection vector.
    */
-  private void assignLongNullsNoRepeatingSelection(int keyIndex, int index, int size,
+  private void assignLongNullsNoRepeatingSelection(int index, int size,
       LongColumnVector columnVector, int[] selected) {
     for(int i = 0; i < size; ++i) {
       int row = selected[i];
       if (!columnVector.isNull[row]) {
         vectorHashKeyWrappers[i].assignLong(index, columnVector.vector[row]);
       } else {
-        vectorHashKeyWrappers[i].assignNullLong(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullLong(index);
       }
     }
   }
@@ -629,10 +417,10 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for double type, repeating nulls.
    */
-  private void assignLongNullsRepeating(int keyIndex, int index, int size,
+  private void assignLongNullsRepeating(int index, int size,
       LongColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
-      vectorHashKeyWrappers[r].assignNullLong(keyIndex, index);
+      vectorHashKeyWrappers[r].assignNullLong(index);
     }
   }
 
@@ -640,13 +428,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for double type, possible nulls, no repeat values, no selection vector.
    */
-  private void assignLongNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
+  private void assignLongNullsNoRepeatingNoSelection(int index, int size,
       LongColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
       if (!columnVector.isNull[r]) {
         vectorHashKeyWrappers[r].assignLong(index, columnVector.vector[r]);
       } else {
-        vectorHashKeyWrappers[r].assignNullLong(keyIndex, index);
+        vectorHashKeyWrappers[r].assignNullLong(index);
       }
     }
   }
@@ -687,14 +475,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Decimal type, possible nulls, no repeat values, batch selection vector.
    */
-  private void assignDecimalNullsNoRepeatingSelection(int keyIndex, int index, int size,
+  private void assignDecimalNullsNoRepeatingSelection(int index, int size,
       DecimalColumnVector columnVector, int[] selected) {
     for(int i = 0; i < size; ++i) {
       int row = selected[i];
       if (!columnVector.isNull[row]) {
         vectorHashKeyWrappers[i].assignDecimal(index, columnVector.vector[row]);
       } else {
-        vectorHashKeyWrappers[i].assignNullDecimal(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullDecimal(index);
       }
     }
   }
@@ -703,10 +491,10 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Decimal type, repeat null values.
    */
-  private void assignDecimalNullsRepeating(int keyIndex, int index, int size,
+  private void assignDecimalNullsRepeating(int index, int size,
       DecimalColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
-      vectorHashKeyWrappers[r].assignNullDecimal(keyIndex, index);
+      vectorHashKeyWrappers[r].assignNullDecimal(index);
     }
   }
 
@@ -714,13 +502,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Decimal type, possible nulls, repeat values.
    */
-  private void assignDecimalNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
+  private void assignDecimalNullsNoRepeatingNoSelection(int index, int size,
       DecimalColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
       if (!columnVector.isNull[r]) {
         vectorHashKeyWrappers[r].assignDecimal(index, columnVector.vector[r]);
       } else {
-        vectorHashKeyWrappers[r].assignNullDecimal(keyIndex, index);
+        vectorHashKeyWrappers[r].assignNullDecimal(index);
       }
     }
   }
@@ -761,14 +549,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Timestamp type, possible nulls, no repeat values, batch selection vector.
    */
-  private void assignTimestampNullsNoRepeatingSelection(int keyIndex, int index, int size,
+  private void assignTimestampNullsNoRepeatingSelection(int index, int size,
       TimestampColumnVector columnVector, int[] selected) {
     for(int i = 0; i < size; ++i) {
       int row = selected[i];
       if (!columnVector.isNull[row]) {
         vectorHashKeyWrappers[i].assignTimestamp(index, columnVector, row);
       } else {
-        vectorHashKeyWrappers[i].assignNullTimestamp(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullTimestamp(index);
       }
     }
   }
@@ -777,10 +565,10 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Timestamp type, repeat null values.
    */
-  private void assignTimestampNullsRepeating(int keyIndex, int index, int size,
+  private void assignTimestampNullsRepeating(int index, int size,
       TimestampColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
-      vectorHashKeyWrappers[r].assignNullTimestamp(keyIndex, index);
+      vectorHashKeyWrappers[r].assignNullTimestamp(index);
     }
   }
 
@@ -788,13 +576,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for Timestamp type, possible nulls, repeat values.
    */
-  private void assignTimestampNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
+  private void assignTimestampNullsNoRepeatingNoSelection(int index, int size,
       TimestampColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
       if (!columnVector.isNull[r]) {
         vectorHashKeyWrappers[r].assignTimestamp(index, columnVector, r);
       } else {
-        vectorHashKeyWrappers[r].assignNullTimestamp(keyIndex, index);
+        vectorHashKeyWrappers[r].assignNullTimestamp(index);
       }
     }
   }
@@ -835,14 +623,14 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for IntervalDayTime type, possible nulls, no repeat values, batch selection vector.
    */
-  private void assignIntervalDayTimeNullsNoRepeatingSelection(int keyIndex, int index, int size,
+  private void assignIntervalDayTimeNullsNoRepeatingSelection(int index, int size,
       IntervalDayTimeColumnVector columnVector, int[] selected) {
     for(int i = 0; i < size; ++i) {
       int row = selected[i];
       if (!columnVector.isNull[row]) {
         vectorHashKeyWrappers[i].assignIntervalDayTime(index, columnVector, row);
       } else {
-        vectorHashKeyWrappers[i].assignNullIntervalDayTime(keyIndex, index);
+        vectorHashKeyWrappers[i].assignNullIntervalDayTime(index);
       }
     }
   }
@@ -851,10 +639,10 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for IntervalDayTime type, repeat null values.
    */
-  private void assignIntervalDayTimeNullsRepeating(int keyIndex, int index, int size,
+  private void assignIntervalDayTimeNullsRepeating(int index, int size,
       IntervalDayTimeColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
-      vectorHashKeyWrappers[r].assignNullIntervalDayTime(keyIndex, index);
+      vectorHashKeyWrappers[r].assignNullIntervalDayTime(index);
     }
   }
 
@@ -862,13 +650,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
    * Helper method to assign values from a vector column into the key wrapper.
    * Optimized for IntervalDayTime type, possible nulls, repeat values.
    */
-  private void assignIntervalDayTimeNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
+  private void assignIntervalDayTimeNullsNoRepeatingNoSelection(int index, int size,
       IntervalDayTimeColumnVector columnVector) {
     for(int r = 0; r < size; ++r) {
       if (!columnVector.isNull[r]) {
         vectorHashKeyWrappers[r].assignIntervalDayTime(index, columnVector, r);
       } else {
-        vectorHashKeyWrappers[r].assignNullIntervalDayTime(keyIndex, index);
+        vectorHashKeyWrappers[r].assignNullIntervalDayTime(index);
       }
     }
   }
@@ -905,28 +693,13 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
     }
   }
 
-  public static VectorHashKeyWrapperBatch compileKeyWrapperBatch(VectorExpression[] keyExpressions)
-      throws HiveException
-  {
-
-    final int size = keyExpressions.length;
-    ColumnVector.Type[] columnVectorTypes = new ColumnVector.Type[size];
-    for (int i = 0; i < size; i++) {
-      String typeName = VectorizationContext.mapTypeNameSynonyms(keyExpressions[i].getOutputType());
-      TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(typeName);
-      columnVectorTypes[i] = VectorizationContext.getColumnVectorTypeFromTypeInfo(typeInfo);
-    }
-    return compileKeyWrapperBatch(keyExpressions, columnVectorTypes);
-  }
-
   /**
    * Prepares a VectorHashKeyWrapperBatch to work for a specific set of keys.
    * Computes the fast access lookup indices, preallocates all needed internal arrays.
    * This step is done only once per query, not once per batch. The information computed now
    * will be used to generate proper individual VectorKeyHashWrapper objects.
    */
-  public static VectorHashKeyWrapperBatch compileKeyWrapperBatch(VectorExpression[] keyExpressions,
-      ColumnVector.Type[] columnVectorTypes)
+  public static VectorHashKeyWrapperBatch compileKeyWrapperBatch(VectorExpression[] keyExpressions)
     throws HiveException {
     VectorHashKeyWrapperBatch compiledKeyWrapperBatch = new VectorHashKeyWrapperBatch(keyExpressions.length);
     compiledKeyWrapperBatch.keyExpressions = keyExpressions;
@@ -934,8 +707,8 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
     compiledKeyWrapperBatch.keysFixedSize = 0;
 
     // Inspect the output type of each key expression.
-    for(int i=0; i < columnVectorTypes.length; ++i) {
-      compiledKeyWrapperBatch.addKey(columnVectorTypes[i]);
+    for(int i=0; i < keyExpressions.length; ++i) {
+      compiledKeyWrapperBatch.addKey(keyExpressions[i].getOutputType());
     }
     compiledKeyWrapperBatch.finishAdding();
 
@@ -971,54 +744,49 @@ public class VectorHashKeyWrapperBatch extends VectorColumnSetInfo {
   }
 
   public VectorHashKeyWrapper allocateKeyWrapper() {
-    return VectorHashKeyWrapper.allocate(hashCtx,
-        longIndices.length,
-        doubleIndices.length,
-        stringIndices.length,
-        decimalIndices.length,
-        timestampIndices.length,
-        intervalDayTimeIndices.length,
-        keyCount);
+    return VectorHashKeyWrapper.allocate(longIndices.length, doubleIndices.length,
+        stringIndices.length, decimalIndices.length, timestampIndices.length,
+        intervalDayTimeIndices.length);
   }
 
   /**
    * Get the row-mode writable object value of a key from a key wrapper
    * @param keyOutputWriter
    */
-  public Object getWritableKeyValue(VectorHashKeyWrapper kw, int keyIndex,
+  public Object getWritableKeyValue(VectorHashKeyWrapper kw, int i,
       VectorExpressionWriter keyOutputWriter)
     throws HiveException {
 
-    if (kw.isNull(keyIndex)) {
-      return null;
-    }
-
-    ColumnVector.Type columnVectorType = columnVectorTypes[keyIndex];
-    int columnTypeSpecificIndex = columnTypeSpecificIndices[keyIndex];
-
-    switch (columnVectorType) {
-    case LONG:
-      return keyOutputWriter.writeValue(
-          kw.getLongValue(columnTypeSpecificIndex));
-    case DOUBLE:
-      return keyOutputWriter.writeValue(
-          kw.getDoubleValue(columnTypeSpecificIndex));
-    case BYTES:
-      return keyOutputWriter.writeValue(
-          kw.getBytes(columnTypeSpecificIndex),
-          kw.getByteStart(columnTypeSpecificIndex),
-          kw.getByteLength(columnTypeSpecificIndex));
-    case DECIMAL:
-      return keyOutputWriter.writeValue(
-          kw.getDecimal(columnTypeSpecificIndex));
-    case TIMESTAMP:
-      return keyOutputWriter.writeValue(
-          kw.getTimestamp(columnTypeSpecificIndex));
-    case INTERVAL_DAY_TIME:
-      return keyOutputWriter.writeValue(
-          kw.getIntervalDayTime(columnTypeSpecificIndex));
-    default:
-      throw new HiveException("Unexpected column vector type " + columnVectorType);
+    KeyLookupHelper klh = indexLookup[i];
+    if (klh.longIndex >= 0) {
+      return kw.getIsLongNull(klh.longIndex) ? null :
+        keyOutputWriter.writeValue(kw.getLongValue(klh.longIndex));
+    } else if (klh.doubleIndex >= 0) {
+      return kw.getIsDoubleNull(klh.doubleIndex) ? null :
+          keyOutputWriter.writeValue(kw.getDoubleValue(klh.doubleIndex));
+    } else if (klh.stringIndex >= 0) {
+      return kw.getIsBytesNull(klh.stringIndex) ? null :
+          keyOutputWriter.writeValue(
+              kw.getBytes(klh.stringIndex),
+                kw.getByteStart(klh.stringIndex),
+                kw.getByteLength(klh.stringIndex));
+    } else if (klh.decimalIndex >= 0) {
+      return kw.getIsDecimalNull(klh.decimalIndex)? null :
+          keyOutputWriter.writeValue(
+                kw.getDecimal(klh.decimalIndex));
+    } else if (klh.timestampIndex >= 0) {
+      return kw.getIsTimestampNull(klh.timestampIndex)? null :
+          keyOutputWriter.writeValue(
+                kw.getTimestamp(klh.timestampIndex));
+    } else if (klh.intervalDayTimeIndex >= 0) {
+      return kw.getIsIntervalDayTimeNull(klh.intervalDayTimeIndex)? null :
+        keyOutputWriter.writeValue(
+              kw.getIntervalDayTime(klh.intervalDayTimeIndex));
+    } else {
+      throw new HiveException(String.format(
+          "Internal inconsistent KeyLookupHelper at index [%d]:%d %d %d %d %d %d",
+          i, klh.longIndex, klh.doubleIndex, klh.stringIndex, klh.decimalIndex,
+          klh.timestampIndex, klh.intervalDayTimeIndex));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorMapJoinOperator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorMapJoinOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorMapJoinOperator.java
index 4e05fa3..848fc8e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorMapJoinOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorMapJoinOperator.java
@@ -215,9 +215,6 @@ public class VectorMapJoinOperator extends VectorMapJoinBaseOperator {
       }
     }
 
-    for (VectorExpression ve : keyExpressions) {
-      ve.evaluate(inBatch);
-    }
     keyWrapperBatch.evaluateBatch(inBatch);
     keyValues = keyWrapperBatch.getVectorHashKeyWrappers();
 

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSMBMapJoinOperator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSMBMapJoinOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSMBMapJoinOperator.java
index f8c4223..ac3363e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSMBMapJoinOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorSMBMapJoinOperator.java
@@ -257,9 +257,6 @@ public class VectorSMBMapJoinOperator extends SMBMapJoinOperator implements Vect
         }
       }
 
-      for (VectorExpression ve : keyExpressions) {
-        ve.evaluate(inBatch);
-      }
       keyWrapperBatch.evaluateBatch(inBatch);
       keyValues = keyWrapperBatch.getVectorHashKeyWrappers();
 

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
index c3940cb..5b0c2bf 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
@@ -1359,7 +1359,7 @@ public class VectorizationContext {
     return "arguments: " + Arrays.toString(args) + ", argument classes: " + argClasses.toString();
   }
 
-  private static final int STACK_LENGTH_LIMIT = 15;
+  private static int STACK_LENGTH_LIMIT = 15;
 
   public static String getStackTraceAsSingleLine(Throwable e) {
     StringBuilder sb = new StringBuilder();
@@ -1461,8 +1461,6 @@ public class VectorizationContext {
       ve = getBetweenFilterExpression(childExpr, mode, returnType);
     } else if (udf instanceof GenericUDFIn) {
       ve = getInExpression(childExpr, mode, returnType);
-    } else if (udf instanceof GenericUDFWhen) {
-      ve = getWhenExpression(childExpr, mode, returnType);
     } else if (udf instanceof GenericUDFOPPositive) {
       ve = getIdentityExpression(childExpr);
     } else if (udf instanceof GenericUDFCoalesce || udf instanceof GenericUDFNvl) {
@@ -2322,54 +2320,6 @@ public class VectorizationContext {
     return createVectorExpression(cl, childrenAfterNot, VectorExpressionDescriptor.Mode.PROJECTION, returnType);
   }
 
-  private boolean isColumnOrNonNullConst(ExprNodeDesc exprNodeDesc) {
-    if (exprNodeDesc instanceof ExprNodeColumnDesc) {
-      return true;
-    }
-    if (exprNodeDesc instanceof ExprNodeConstantDesc) {
-      String typeString = exprNodeDesc.getTypeString();
-      if (!typeString.equalsIgnoreCase("void")) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private VectorExpression getWhenExpression(List<ExprNodeDesc> childExpr,
-      VectorExpressionDescriptor.Mode mode, TypeInfo returnType) throws HiveException {
-
-    if (mode != VectorExpressionDescriptor.Mode.PROJECTION) {
-      return null;
-    }
-    if (childExpr.size() != 3) {
-      // For now, we only optimize the 2 value case.
-      return null;
-    }
-
-    /*
-     * When we have 2 simple values:
-     *                          CASE WHEN boolExpr THEN column | const ELSE column | const END
-     * then we can convert to:        IF (boolExpr THEN column | const ELSE column | const)
-     */
-    // CONSIDER: Adding a version of IfExpr* than can handle a non-column/const expression in the
-    //           THEN or ELSE.
-    ExprNodeDesc exprNodeDesc1 = childExpr.get(1);
-    ExprNodeDesc exprNodeDesc2 = childExpr.get(2);
-    if (isColumnOrNonNullConst(exprNodeDesc1) &&
-        isColumnOrNonNullConst(exprNodeDesc2)) {
-      // Yes.
-      GenericUDFIf genericUDFIf = new GenericUDFIf();
-      return
-          getVectorExpressionForUdf(
-            genericUDFIf,
-            GenericUDFIf.class,
-            childExpr,
-            mode,
-            returnType);
-    }
-    return null;   // Not handled by vector classes yet.
-  }
-
   /*
    * Return vector expression for a custom (i.e. not built-in) UDF.
    */

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastStringToLong.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastStringToLong.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastStringToLong.java
deleted file mode 100644
index 5a8a825..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CastStringToLong.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hive.ql.exec.vector.expressions;
-
-import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
-import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
-import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor;
-import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
-import org.apache.hadoop.hive.serde2.lazy.LazyByte;
-import org.apache.hadoop.hive.serde2.lazy.LazyInteger;
-import org.apache.hadoop.hive.serde2.lazy.LazyLong;
-import org.apache.hadoop.hive.serde2.lazy.LazyShort;
-import org.apache.hadoop.hive.serde2.lazy.LazyUtils;
-import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
-import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
-
-/**
- * Cast a string to a long.
- *
- * If other functions besides cast need to take a string in and produce a long,
- * you can subclass this class or convert it to a superclass, and
- * implement different "func()" methods for each operation.
- */
-public class CastStringToLong extends VectorExpression {
-  private static final long serialVersionUID = 1L;
-  int inputColumn;
-  int outputColumn;
-
-  private transient boolean integerPrimitiveCategoryKnown = false;
-  protected transient PrimitiveCategory integerPrimitiveCategory;
-
-  public CastStringToLong(int inputColumn, int outputColumn) {
-    super();
-    this.inputColumn = inputColumn;
-    this.outputColumn = outputColumn;
-  }
-
-  public CastStringToLong() {
-    super();
-  }
-
-  /**
-   * Convert input string to a long, at position i in the respective vectors.
-   */
-  protected void func(LongColumnVector outV, BytesColumnVector inV, int batchIndex) {
-
-    byte[] bytes = inV.vector[batchIndex];
-    final int start = inV.start[batchIndex];
-    final int length = inV.length[batchIndex];
-    try {
-
-      switch (integerPrimitiveCategory) {
-      case BOOLEAN:
-        {
-          boolean booleanValue;
-          int i = start;
-          if (length == 4) {
-            if ((bytes[i] == 'T' || bytes[i] == 't') &&
-                (bytes[i + 1] == 'R' || bytes[i + 1] == 'r') &&
-                (bytes[i + 2] == 'U' || bytes[i + 2] == 'u') &&
-                (bytes[i + 3] == 'E' || bytes[i + 3] == 'e')) {
-              booleanValue = true;
-            } else {
-              // No boolean value match for 4 char field.
-              outV.noNulls = false;
-              outV.isNull[batchIndex] = true;
-              return;
-            }
-          } else if (length == 5) {
-            if ((bytes[i] == 'F' || bytes[i] == 'f') &&
-                (bytes[i + 1] == 'A' || bytes[i + 1] == 'a') &&
-                (bytes[i + 2] == 'L' || bytes[i + 2] == 'l') &&
-                (bytes[i + 3] == 'S' || bytes[i + 3] == 's') &&
-                (bytes[i + 4] == 'E' || bytes[i + 4] == 'e')) {
-              booleanValue = false;
-            } else {
-              // No boolean value match for 5 char field.
-              outV.noNulls = false;
-              outV.isNull[batchIndex] = true;
-              return;
-            }
-          } else if (length == 1) {
-            byte b = bytes[start];
-            if (b == '1' || b == 't' || b == 'T') {
-              booleanValue = true;
-            } else if (b == '0' || b == 'f' || b == 'F') {
-              booleanValue = false;
-            } else {
-              // No boolean value match for extended 1 char field.
-              outV.noNulls = false;
-              outV.isNull[batchIndex] = true;
-              return;
-            }
-          } else {
-            // No boolean value match for other lengths.
-            outV.noNulls = false;
-            outV.isNull[batchIndex] = true;
-            return;
-          }
-          outV.vector[batchIndex] = (booleanValue ? 1 : 0);
-        }
-        break;
-      case BYTE:
-        if (!LazyUtils.isNumberMaybe(bytes, start, length)) {
-          outV.noNulls = false;
-          outV.isNull[batchIndex] = true;
-          return;
-        }
-        outV.vector[batchIndex] = LazyByte.parseByte(bytes, start, length, 10);
-        break;
-      case SHORT:
-        if (!LazyUtils.isNumberMaybe(bytes, start, length)) {
-          outV.noNulls = false;
-          outV.isNull[batchIndex] = true;
-          return;
-        }
-        outV.vector[batchIndex] = LazyShort.parseShort(bytes, start, length, 10);
-        break;
-      case INT:
-        if (!LazyUtils.isNumberMaybe(bytes, start, length)) {
-          outV.noNulls = false;
-          outV.isNull[batchIndex] = true;
-          return;
-        }
-        outV.vector[batchIndex] = LazyInteger.parseInt(bytes, start, length, 10);
-        break;
-      case LONG:
-        if (!LazyUtils.isNumberMaybe(bytes, start, length)) {
-          outV.noNulls = false;
-          outV.isNull[batchIndex] = true;
-          return;
-        }
-        outV.vector[batchIndex] = LazyLong.parseLong(bytes, start, length, 10);
-        break;
-      default:
-        throw new Error("Unexpected primitive category " + integerPrimitiveCategory);
-      }
-    } catch (Exception e) {
-
-      // for any exception in conversion to integer, produce NULL
-      outV.noNulls = false;
-      outV.isNull[batchIndex] = true;
-    }
-  }
-
-  @Override
-  public void evaluate(VectorizedRowBatch batch) {
-
-    if (!integerPrimitiveCategoryKnown) {
-      String typeName = getOutputType().toLowerCase();
-      TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(typeName);
-      integerPrimitiveCategory = ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory();
-      integerPrimitiveCategoryKnown = true;
-    }
-
-    if (childExpressions != null) {
-      super.evaluateChildren(batch);
-    }
-
-    BytesColumnVector inV = (BytesColumnVector) batch.cols[inputColumn];
-    int[] sel = batch.selected;
-    int n = batch.size;
-    LongColumnVector outV = (LongColumnVector) batch.cols[outputColumn];
-
-    if (n == 0) {
-
-      // Nothing to do
-      return;
-    }
-
-    if (inV.noNulls) {
-      outV.noNulls = true;
-      if (inV.isRepeating) {
-        outV.isRepeating = true;
-        func(outV, inV, 0);
-      } else if (batch.selectedInUse) {
-        for(int j = 0; j != n; j++) {
-          int i = sel[j];
-          func(outV, inV, i);
-        }
-        outV.isRepeating = false;
-      } else {
-        for(int i = 0; i != n; i++) {
-          func(outV, inV, i);
-        }
-        outV.isRepeating = false;
-      }
-    } else {
-
-      // Handle case with nulls. Don't do function if the value is null,
-      // because the data may be undefined for a null value.
-      outV.noNulls = false;
-      if (inV.isRepeating) {
-        outV.isRepeating = true;
-        outV.isNull[0] = inV.isNull[0];
-        if (!inV.isNull[0]) {
-          func(outV, inV, 0);
-        }
-      } else if (batch.selectedInUse) {
-        for(int j = 0; j != n; j++) {
-          int i = sel[j];
-          outV.isNull[i] = inV.isNull[i];
-          if (!inV.isNull[i]) {
-            func(outV, inV, i);
-          }
-        }
-        outV.isRepeating = false;
-      } else {
-        System.arraycopy(inV.isNull, 0, outV.isNull, 0, n);
-        for(int i = 0; i != n; i++) {
-          if (!inV.isNull[i]) {
-            func(outV, inV, i);
-          }
-        }
-        outV.isRepeating = false;
-      }
-    }
-  }
-
-  @Override
-  public int getOutputColumn() {
-    return outputColumn;
-  }
-
-  public void setOutputColumn(int outputColumn) {
-    this.outputColumn = outputColumn;
-  }
-
-  public int getInputColumn() {
-    return inputColumn;
-  }
-
-  public void setInputColumn(int inputColumn) {
-    this.inputColumn = inputColumn;
-  }
-
-  @Override
-  public String vectorExpressionParameters() {
-    return "col " + inputColumn;
-  }
-
-  @Override
-  public VectorExpressionDescriptor.Descriptor getDescriptor() {
-    VectorExpressionDescriptor.Builder b = new VectorExpressionDescriptor.Builder();
-    b.setMode(VectorExpressionDescriptor.Mode.PROJECTION)
-        .setNumArguments(1)
-        .setArgumentTypes(
-            VectorExpressionDescriptor.ArgumentType.STRING_FAMILY)
-        .setInputExpressionTypes(
-            VectorExpressionDescriptor.InputExpressionType.COLUMN);
-    return b.build();
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CuckooSetBytes.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CuckooSetBytes.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CuckooSetBytes.java
index 266365e..6383e8a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CuckooSetBytes.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CuckooSetBytes.java
@@ -39,8 +39,8 @@ public class CuckooSetBytes {
   private int salt = 0;
   private Random gen = new Random(676983475);
   private int rehashCount = 0;
-  private static final long INT_MASK  = 0x00000000ffffffffL;
-  private static final long BYTE_MASK = 0x00000000000000ffL;
+  private static long INT_MASK  = 0x00000000ffffffffL;
+  private static long BYTE_MASK = 0x00000000000000ffL;
 
   /**
    * Allocate a new set to hold expectedSize values. Re-allocation to expand

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/OctetLength.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/OctetLength.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/OctetLength.java
deleted file mode 100644
index 3b41ed4..0000000
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/OctetLength.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hive.ql.exec.vector.expressions;
-
-import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
-import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
-import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor;
-import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
-
-public class OctetLength extends VectorExpression {
-  private static final long serialVersionUID = 1L;
-  private int colNum;
-  private int outputColumn;
-
-  public OctetLength(int colNum, int outputColumn) {
-    this();
-    this.colNum = colNum;
-    this.outputColumn = outputColumn;
-  }
-
-  public OctetLength() {
-    super();
-  }
-
-  // Calculate the length of the UTF-8 strings in input vector and place results in output vector.
-  @Override
-  public void evaluate(VectorizedRowBatch batch) {
-
-    if (childExpressions != null) {
-      super.evaluateChildren(batch);
-    }
-
-    BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum];
-    LongColumnVector outV = (LongColumnVector) batch.cols[outputColumn];
-    int[] sel = batch.selected;
-    int n = batch.size;
-    int [] length = inputColVector.length;
-    long[] resultLen = outV.vector;
-
-    if (n == 0) {
-      //Nothing to do
-      return;
-    }
-
-    if (inputColVector.noNulls) {
-      outV.noNulls = true;
-      if (inputColVector.isRepeating) {
-        outV.isRepeating = true;
-        resultLen[0] = length[0];
-      } else if (batch.selectedInUse) {
-        for(int j = 0; j != n; j++) {
-          int i = sel[j];
-          resultLen[i] = length[i];
-        }
-        outV.isRepeating = false;
-      } else {
-        for(int i = 0; i != n; i++) {
-          resultLen[i] = length[i];
-        }
-        outV.isRepeating = false;
-      }
-    } else {
-
-      /*
-       * Handle case with nulls. Don't do function if the value is null, to save time,
-       * because calling the function can be expensive.
-       */
-      outV.noNulls = false;
-      if (inputColVector.isRepeating) {
-        outV.isRepeating = true;
-        outV.isNull[0] = inputColVector.isNull[0];
-        if (!inputColVector.isNull[0]) {
-          resultLen[0] = length[0];
-        }
-      } else if (batch.selectedInUse) {
-        for(int j = 0; j != n; j++) {
-          int i = sel[j];
-          if (!inputColVector.isNull[i]) {
-            resultLen[i] = length[i];
-          }
-          outV.isNull[i] = inputColVector.isNull[i];
-        }
-        outV.isRepeating = false;
-      } else {
-        for(int i = 0; i != n; i++) {
-          if (!inputColVector.isNull[i]) {
-            resultLen[i] = length[i];
-          }
-          outV.isNull[i] = inputColVector.isNull[i];
-        }
-        outV.isRepeating = false;
-      }
-    }
-  }
-
-  @Override
-  public int getOutputColumn() {
-    return outputColumn;
-  }
-
-  @Override
-  public String getOutputType() {
-    return "Long";
-  }
-
-  public int getColNum() {
-    return colNum;
-  }
-
-  public void setColNum(int colNum) {
-    this.colNum = colNum;
-  }
-
-  public void setOutputColumn(int outputColumn) {
-    this.outputColumn = outputColumn;
-  }
-
-  public String vectorExpressionParameters() {
-    return "col " + colNum;
-  }
-
-  @Override
-  public VectorExpressionDescriptor.Descriptor getDescriptor() {
-    VectorExpressionDescriptor.Builder b = new VectorExpressionDescriptor.Builder();
-    b.setMode(VectorExpressionDescriptor.Mode.PROJECTION)
-        .setNumArguments(1)
-        .setArgumentTypes(
-            VectorExpressionDescriptor.ArgumentType.STRING_FAMILY)
-        .setInputExpressionTypes(
-            VectorExpressionDescriptor.InputExpressionType.COLUMN);
-    return b.build();
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorAggregateExpression.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorAggregateExpression.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorAggregateExpression.java
index 7ab4473..0866f63 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorAggregateExpression.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorAggregateExpression.java
@@ -52,7 +52,7 @@ public abstract class VectorAggregateExpression  implements Serializable {
   public abstract Object evaluateOutput(AggregationBuffer agg) throws HiveException;
 
   public abstract ObjectInspector getOutputObjectInspector();
-  public abstract long getAggregationBufferFixedSize();
+  public abstract int getAggregationBufferFixedSize();
   public boolean hasVariableSize() {
     return false;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgDecimal.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgDecimal.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgDecimal.java
index 4aac9d3..74e25ae 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgDecimal.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgDecimal.java
@@ -492,7 +492,7 @@ public class VectorUDAFAvgDecimal extends VectorAggregateExpression {
   }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
     JavaDataModel model = JavaDataModel.get();
     return JavaDataModel.alignUp(
       model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgTimestamp.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgTimestamp.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgTimestamp.java
index 365dcf6..483d9dc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgTimestamp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFAvgTimestamp.java
@@ -464,7 +464,7 @@ public class VectorUDAFAvgTimestamp extends VectorAggregateExpression {
   }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
     JavaDataModel model = JavaDataModel.get();
     return JavaDataModel.alignUp(
       model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilter.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilter.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilter.java
index 52b05ca..2139eae 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilter.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilter.java
@@ -383,7 +383,7 @@ public class VectorUDAFBloomFilter extends VectorAggregateExpression {
   }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
     if (bitSetSize < 0) {
       // Not pretty, but we need a way to get the size
       try {
@@ -396,7 +396,7 @@ public class VectorUDAFBloomFilter extends VectorAggregateExpression {
 
     // BloomFilter: object(BitSet: object(data: long[]), numBits: int, numHashFunctions: int)
     JavaDataModel model = JavaDataModel.get();
-    long bloomFilterSize = JavaDataModel.alignUp(model.object() + model.lengthForLongArrayOfSize(bitSetSize),
+    int bloomFilterSize = JavaDataModel.alignUp(model.object() + model.lengthForLongArrayOfSize(bitSetSize),
         model.memoryAlign());
     return JavaDataModel.alignUp(
         model.object() + bloomFilterSize + model.primitive1() + model.primitive1(),

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilterMerge.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilterMerge.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilterMerge.java
index b986eb4..d2446d5 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilterMerge.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFBloomFilterMerge.java
@@ -339,7 +339,7 @@ public class VectorUDAFBloomFilterMerge extends VectorAggregateExpression {
   }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
     if (aggBufferSize < 0) {
       // Not pretty, but we need a way to get the size
       try {

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCount.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCount.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCount.java
index cadb6dd..494febc 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCount.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCount.java
@@ -259,7 +259,7 @@ public class VectorUDAFCount extends VectorAggregateExpression {
     }
 
     @Override
-    public long getAggregationBufferFixedSize() {
+    public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountMerge.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountMerge.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountMerge.java
index c489f8f..dec88cb 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountMerge.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountMerge.java
@@ -385,7 +385,7 @@ public class VectorUDAFCountMerge extends VectorAggregateExpression {
     }
 
     @Override
-    public long getAggregationBufferFixedSize() {
+    public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountStar.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountStar.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountStar.java
index 3b66030..337ba0a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountStar.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFCountStar.java
@@ -142,7 +142,7 @@ public class VectorUDAFCountStar extends VectorAggregateExpression {
     }
 
     @Override
-    public long getAggregationBufferFixedSize() {
+    public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdPopTimestamp.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdPopTimestamp.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdPopTimestamp.java
index 5388d37..8cd3506 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdPopTimestamp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdPopTimestamp.java
@@ -508,7 +508,7 @@ public class VectorUDAFStdPopTimestamp extends VectorAggregateExpression {
     }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdSampTimestamp.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdSampTimestamp.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdSampTimestamp.java
index 1769dc0..61d6977 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdSampTimestamp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFStdSampTimestamp.java
@@ -508,7 +508,7 @@ public class VectorUDAFStdSampTimestamp extends VectorAggregateExpression {
     }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFSumDecimal.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFSumDecimal.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFSumDecimal.java
index a37e3f6..b10f66f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFSumDecimal.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFSumDecimal.java
@@ -431,7 +431,7 @@ public class VectorUDAFSumDecimal extends VectorAggregateExpression {
     }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object(),

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarPopTimestamp.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarPopTimestamp.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarPopTimestamp.java
index 61cdeaa..2709b07 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarPopTimestamp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarPopTimestamp.java
@@ -508,7 +508,7 @@ public class VectorUDAFVarPopTimestamp extends VectorAggregateExpression {
     }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarSampTimestamp.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarSampTimestamp.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarSampTimestamp.java
index c375461..03dce1e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarSampTimestamp.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/VectorUDAFVarSampTimestamp.java
@@ -508,7 +508,7 @@ public class VectorUDAFVarSampTimestamp extends VectorAggregateExpression {
     }
 
   @Override
-  public long getAggregationBufferFixedSize() {
+  public int getAggregationBufferFixedSize() {
       JavaDataModel model = JavaDataModel.get();
       return JavaDataModel.alignUp(
         model.object() +

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/VectorMapJoinGenerateResultOperator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/VectorMapJoinGenerateResultOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/VectorMapJoinGenerateResultOperator.java
index c4d5113..cb30413 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/VectorMapJoinGenerateResultOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/VectorMapJoinGenerateResultOperator.java
@@ -531,8 +531,6 @@ public abstract class VectorMapJoinGenerateResultOperator extends VectorMapJoinC
   protected void reloadHashTable(byte pos, int partitionId)
           throws IOException, HiveException, SerDeException, ClassNotFoundException {
 
-    this.vectorMapJoinHashTable = null;
-
     // The super method will reload a hash table partition of one of the small tables.
     // Currently, for native vector map join it will only be one small table.
     super.reloadHashTable(pos, partitionId);

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMap.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMap.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMap.java
index b5eab8b..6242daf 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMap.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMap.java
@@ -107,9 +107,4 @@ public abstract class VectorMapJoinFastBytesHashMap
     // Share the same write buffers with our value store.
     keyStore = new VectorMapJoinFastKeyStore(valueStore.writeBuffers());
   }
-
-  @Override
-  public long getEstimatedMemorySize() {
-    return super.getEstimatedMemorySize() + valueStore.getEstimatedMemorySize() + keyStore.getEstimatedMemorySize();
-  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMultiSet.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMultiSet.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMultiSet.java
index e779762..1a41961 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMultiSet.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashMultiSet.java
@@ -97,9 +97,4 @@ public abstract class VectorMapJoinFastBytesHashMultiSet
 
     keyStore = new VectorMapJoinFastKeyStore(writeBuffersSize);
   }
-
-  @Override
-  public long getEstimatedMemorySize() {
-    return super.getEstimatedMemorySize() + keyStore.getEstimatedMemorySize();
-  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashSet.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashSet.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashSet.java
index d493319..331867c 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashSet.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashSet.java
@@ -84,9 +84,4 @@ public abstract class VectorMapJoinFastBytesHashSet
 
     keyStore = new VectorMapJoinFastKeyStore(writeBuffersSize);
   }
-
-  @Override
-  public long getEstimatedMemorySize() {
-    return super.getEstimatedMemorySize() + keyStore.getEstimatedMemorySize();
-  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashTable.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashTable.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashTable.java
index 10bc902..b93e977 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashTable.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastBytesHashTable.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast;
 
 import java.io.IOException;
 
-import org.apache.hadoop.hive.ql.util.JavaDataModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinBytesHashTable;
@@ -219,9 +218,4 @@ public abstract class VectorMapJoinFastBytesHashTable
     super(initialCapacity, loadFactor, writeBuffersSize, estimatedKeyCount);
     allocateBucketArray();
   }
-
-  @Override
-  public long getEstimatedMemorySize() {
-    return super.getEstimatedMemorySize() + JavaDataModel.get().lengthForLongArrayOfSize(slotTriples.length);
-  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ed64a74e/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTable.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTable.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTable.java
index 1f182ee..9030e5f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTable.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTable.java
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.hive.ql.exec.vector.mapjoin.fast;
 
-import org.apache.hadoop.hive.ql.util.JavaDataModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.hive.ql.exec.vector.mapjoin.hashtable.VectorMapJoinHashTable;
@@ -41,10 +40,10 @@ public abstract class VectorMapJoinFastHashTable implements VectorMapJoinHashTab
   protected int metricExpands;
 
   // 2^30 (we cannot use Integer.MAX_VALUE which is 2^31-1).
-  public static final int HIGHEST_INT_POWER_OF_2 = 1073741824;
+  public static int HIGHEST_INT_POWER_OF_2 = 1073741824;
 
-  public static final int ONE_QUARTER_LIMIT = HIGHEST_INT_POWER_OF_2 / 4;
-  public static final int ONE_SIXTH_LIMIT = HIGHEST_INT_POWER_OF_2 / 6;
+  public static int ONE_QUARTER_LIMIT = HIGHEST_INT_POWER_OF_2 / 4;
+  public static int ONE_SIXTH_LIMIT = HIGHEST_INT_POWER_OF_2 / 6;
 
   public void throwExpandError(int limit, String dataTypeName) {
     throw new RuntimeException(
@@ -89,10 +88,4 @@ public abstract class VectorMapJoinFastHashTable implements VectorMapJoinHashTab
   public int size() {
     return keysAssigned;
   }
-
-  @Override
-  public long getEstimatedMemorySize() {
-    JavaDataModel jdm = JavaDataModel.get();
-    return JavaDataModel.alignUp(10L * jdm.primitive1() + jdm.primitive2(), jdm.memoryAlign());
-  }
 }


Mime
View raw message