You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/04/23 23:41:06 UTC

svn commit: r1471159 [3/4] - in /hive/branches/vectorization/ql/src: java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/ java/org/apache/hadoop/hive/ql/exec/vector/expressions/templates/ test/org/apache/hadoop/hive/ql/exec/vector/expressions/

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColGreaterEqualLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColGreaterEqualLongColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] >= vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] >= vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] >= vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] >= vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] >= vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] >= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] >=  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] >= vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] >= vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] >= vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] >= vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] >= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] >= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColGreaterLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColGreaterLongColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] > vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] > vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] > vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] > vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] > vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] > vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] >  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] > vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] > vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] > vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] > vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] > vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] > vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColLessDoubleColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColLessDoubleColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    double[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] < vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] < vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] < vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] < vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] < vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] < vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] <  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] < vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] < vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] < vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] < vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] < vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] < vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColLessEqualDoubleColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColLessEqualDoubleColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    double[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] <= vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] <= vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] <= vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] <= vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] <= vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] <= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] <=  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] <= vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] <= vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] <= vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] <= vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] <= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] <= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColLessEqualLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColLessEqualLongColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] <= vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] <= vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] <= vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] <= vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] <= vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] <= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] <=  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] <= vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] <= vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] <= vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] <= vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] <= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] <= vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColLessLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColLessLongColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] < vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] < vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] < vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] < vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] < vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] < vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] <  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] < vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] < vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] < vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] < vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] < vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] < vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColNotEqualDoubleColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColNotEqualDoubleColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    double[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] != vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] != vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] != vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] != vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] != vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] != vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] !=  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] != vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] != vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] != vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] != vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] != vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] != vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,222 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class FilterLongColNotEqualLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+
+  public FilterLongColNotEqualLongColumn(int colNum1, int colNum2) { 
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    int[] sel = batch.selected;
+    boolean[] nullPos1 = inputColVector1.isNull;
+    boolean[] nullPos2 = inputColVector2.isNull;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+    
+    if (inputColVector1.noNulls && inputColVector2.noNulls) {
+      if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+        //All must be selected otherwise size would be zero
+        //Repeating property will not change.
+        if (!(vector1[0] != vector2[0])) {
+          batch.size = 0;
+        }
+      } else if (inputColVector1.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[0] != vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[0] != vector2[i]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (inputColVector2.isRepeating) {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (vector1[i] != vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (vector1[i] != vector2[0]) {
+              sel[newSize++] = i;
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      } else if (batch.selectedInUse) {
+        int newSize = 0;
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          if (vector1[i] != vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        batch.size = newSize;
+      } else {
+        int newSize = 0;
+        for(int i = 0; i != n; i++) {
+          if (vector1[i] !=  vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+        if (newSize < batch.size) {
+          batch.size = newSize;
+          batch.selectedInUse = true;
+        }
+      }
+    } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) {
+      if (nullPos1[0] || nullPos2[0]) {
+        batch.size = 0; 
+      } 
+    } else if (inputColVector1.isRepeating) {
+      if (nullPos1[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos2[i]) {
+              if (vector1[0] != vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos2[i]) {
+              if (vector1[0] != vector2[i]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (nullPos2[0]) {
+        batch.size = 0;
+      } else {
+        if (batch.selectedInUse) {
+          int newSize = 0;
+          for(int j=0; j != n; j++) {
+            int i = sel[j];
+            if (!nullPos1[i]) {
+              if (vector1[i] != vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          batch.size = newSize;
+        } else {
+          int newSize = 0;
+          for(int i = 0; i != n; i++) {
+            if (!nullPos1[i]) {
+              if (vector1[i] != vector2[0]) {
+                sel[newSize++] = i;
+              }
+            }
+          }
+          if (newSize < batch.size) {
+            batch.size = newSize;
+            batch.selectedInUse = true;
+          }
+        }
+      }
+    } else if (batch.selectedInUse) {
+      int newSize = 0;
+      for(int j=0; j != n; j++) {
+        int i = sel[j];
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] != vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      batch.size = newSize;
+    } else {
+      int newSize = 0;
+      for(int i = 0; i != n; i++) {
+        if (!nullPos1[i] && !nullPos2[i]) {
+          if (vector1[i] != vector2[i]) {
+            sel[newSize++] = i;
+          }
+        }
+      }
+      if (newSize < batch.size) {
+        batch.size = newSize;
+        batch.selectedInUse = true;
+      }
+    }
+  }
+
+  @Override
+  public String getOutputType() {
+    return "boolean";
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return -1;
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,173 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class LongColAddDoubleColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+  int outputColumn;
+
+  public LongColAddDoubleColumn(int colNum1, int colNum2, int outputColumn) {
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+    this.outputColumn = outputColumn;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+
+    if (childExpressions != null) {
+      super.evaluateChildren(batch);
+    }
+
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2];
+    DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn];
+    int[] sel = batch.selected;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    double[] vector2 = inputColVector2.vector;
+
+    double[] outputVector = outputColVector.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+
+    //Handle nulls first
+    if (inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isNull[0] = true;
+        outputColVector.isRepeating = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating || inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        }
+      }
+    }
+
+
+    //Disregard nulls for processing
+    if (inputColVector1.isRepeating && inputColVector2.isRepeating) { 
+      //All must be selected otherwise size would be zero
+      //Repeating property will not change.
+      outputVector[0] = vector1[0] + vector2[0];
+      outputColVector.isRepeating = true;
+    } else if (inputColVector1.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[0] + vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[0] + vector2[i];
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] + vector2[0];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] + vector2[0];
+        }
+      }
+    } else {
+      if (batch.selectedInUse) {
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] + vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] +  vector2[i];
+        }
+      }
+    }
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return outputColumn;
+  }
+
+  @Override
+  public String getOutputType() {
+    return "double";
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,173 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class LongColAddLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+  int outputColumn;
+
+  public LongColAddLongColumn(int colNum1, int colNum2, int outputColumn) {
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+    this.outputColumn = outputColumn;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+
+    if (childExpressions != null) {
+      super.evaluateChildren(batch);
+    }
+
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn];
+    int[] sel = batch.selected;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+
+    long[] outputVector = outputColVector.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+
+    //Handle nulls first
+    if (inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isNull[0] = true;
+        outputColVector.isRepeating = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating || inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        }
+      }
+    }
+
+
+    //Disregard nulls for processing
+    if (inputColVector1.isRepeating && inputColVector2.isRepeating) { 
+      //All must be selected otherwise size would be zero
+      //Repeating property will not change.
+      outputVector[0] = vector1[0] + vector2[0];
+      outputColVector.isRepeating = true;
+    } else if (inputColVector1.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[0] + vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[0] + vector2[i];
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] + vector2[0];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] + vector2[0];
+        }
+      }
+    } else {
+      if (batch.selectedInUse) {
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] + vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] +  vector2[i];
+        }
+      }
+    }
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return outputColumn;
+  }
+
+  @Override
+  public String getOutputType() {
+    return "long";
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,173 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class LongColDivideDoubleColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+  int outputColumn;
+
+  public LongColDivideDoubleColumn(int colNum1, int colNum2, int outputColumn) {
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+    this.outputColumn = outputColumn;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+
+    if (childExpressions != null) {
+      super.evaluateChildren(batch);
+    }
+
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2];
+    DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn];
+    int[] sel = batch.selected;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    double[] vector2 = inputColVector2.vector;
+
+    double[] outputVector = outputColVector.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+
+    //Handle nulls first
+    if (inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isNull[0] = true;
+        outputColVector.isRepeating = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating || inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        }
+      }
+    }
+
+
+    //Disregard nulls for processing
+    if (inputColVector1.isRepeating && inputColVector2.isRepeating) { 
+      //All must be selected otherwise size would be zero
+      //Repeating property will not change.
+      outputVector[0] = vector1[0] / vector2[0];
+      outputColVector.isRepeating = true;
+    } else if (inputColVector1.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[0] / vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[0] / vector2[i];
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] / vector2[0];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] / vector2[0];
+        }
+      }
+    } else {
+      if (batch.selectedInUse) {
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] / vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] /  vector2[i];
+        }
+      }
+    }
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return outputColumn;
+  }
+
+  @Override
+  public String getOutputType() {
+    return "double";
+  }
+}

Added: hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideLongColumn.java
URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideLongColumn.java?rev=1471159&view=auto
==============================================================================
--- hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideLongColumn.java (added)
+++ hive/branches/vectorization/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideLongColumn.java Tue Apr 23 21:41:05 2013
@@ -0,0 +1,173 @@
+/**
+ * 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.gen;
+
+import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression;
+import org.apache.hadoop.hive.ql.exec.vector.*;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+
+public class LongColDivideLongColumn extends VectorExpression {
+  int colNum1;
+  int colNum2;
+  int outputColumn;
+
+  public LongColDivideLongColumn(int colNum1, int colNum2, int outputColumn) {
+    this.colNum1 = colNum1;
+    this.colNum2 = colNum2;
+    this.outputColumn = outputColumn;
+  }
+
+  @Override
+  public void evaluate(VectorizedRowBatch batch) {
+
+    if (childExpressions != null) {
+      super.evaluateChildren(batch);
+    }
+
+    LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1];
+    LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2];
+    LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn];
+    int[] sel = batch.selected;
+    int n = batch.size;
+    long[] vector1 = inputColVector1.vector;
+    long[] vector2 = inputColVector2.vector;
+
+    long[] outputVector = outputColVector.vector;
+    
+    // return immediately if batch is empty
+    if (n == 0) {
+      return;
+    }
+
+    //Handle nulls first
+    if (inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isNull[0] = true;
+        outputColVector.isRepeating = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector2.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i];
+          }
+        }
+      }
+    } else if (!inputColVector1.noNulls && !inputColVector2.noNulls) {
+      outputColVector.noNulls = false;
+      if (inputColVector1.isRepeating || inputColVector2.isRepeating) {
+        //Output will also be repeating and null
+        outputColVector.isRepeating = true;
+        outputColVector.isNull[0] = true;
+        //return as no further processing is needed
+        return;
+      } else {
+        if (batch.selectedInUse) {
+          for(int j = 0; j != n; j++) {
+            int i = sel[j];
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        } else {
+          for(int i = 0; i != n; i++) {
+            outputColVector.isNull[i] = inputColVector1.isNull[i] || inputColVector2.isNull[i];
+          }
+        }
+      }
+    }
+
+
+    //Disregard nulls for processing
+    if (inputColVector1.isRepeating && inputColVector2.isRepeating) { 
+      //All must be selected otherwise size would be zero
+      //Repeating property will not change.
+      outputVector[0] = vector1[0] / vector2[0];
+      outputColVector.isRepeating = true;
+    } else if (inputColVector1.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[0] / vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[0] / vector2[i];
+        }
+      }
+    } else if (inputColVector2.isRepeating) {
+      if (batch.selectedInUse) {
+        for(int j = 0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] / vector2[0];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] / vector2[0];
+        }
+      }
+    } else {
+      if (batch.selectedInUse) {
+        for(int j=0; j != n; j++) {
+          int i = sel[j];
+          outputVector[i] = vector1[i] / vector2[i];
+        }
+      } else {
+        for(int i = 0; i != n; i++) {
+          outputVector[i] = vector1[i] /  vector2[i];
+        }
+      }
+    }
+  }
+
+  @Override
+  public int getOutputColumn() {
+    return outputColumn;
+  }
+
+  @Override
+  public String getOutputType() {
+    return "long";
+  }
+}