You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2015/03/28 15:03:49 UTC

svn commit: r1669775 [2/35] - in /hive/branches/spark: ./ ant/src/org/apache/hadoop/hive/ant/ beeline/src/java/org/apache/hive/beeline/ common/src/java/org/apache/hadoop/hive/common/ common/src/java/org/apache/hadoop/hive/common/type/ common/src/java/o...

Modified: hive/branches/spark/ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java (original)
+++ hive/branches/spark/ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java Sat Mar 28 14:03:43 2015
@@ -35,6 +35,89 @@ public class GenVectorCode extends Task
 
   private static String [][] templateExpansions =
     {
+      // The following datetime/interval arithmetic operations can be done using the vectorized values
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Add", "interval_year_month", "interval_year_month", "+"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Add", "interval_year_month", "interval_year_month", "+"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Add", "interval_year_month", "interval_year_month", "+"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Subtract", "interval_year_month", "interval_year_month", "-"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Subtract", "interval_year_month", "interval_year_month", "-"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Subtract", "interval_year_month", "interval_year_month", "-"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Add", "interval_day_time", "interval_day_time", "+"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Add", "interval_day_time", "interval_day_time", "+"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Add", "interval_day_time", "interval_day_time", "+"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Subtract", "interval_day_time", "interval_day_time", "-"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Subtract", "interval_day_time", "interval_day_time", "-"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Subtract", "interval_day_time", "interval_day_time", "-"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Add", "interval_day_time", "timestamp", "+"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Add", "interval_day_time", "timestamp", "+"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Add", "interval_day_time", "timestamp", "+"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Add", "timestamp", "interval_day_time", "+"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Add", "timestamp", "interval_day_time", "+"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Add", "timestamp", "interval_day_time", "+"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Subtract", "timestamp", "interval_day_time", "-"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Subtract", "timestamp", "interval_day_time", "-"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Subtract", "timestamp", "interval_day_time", "-"},
+
+      {"DTIColumnArithmeticDTIScalarNoConvert", "Subtract", "timestamp", "timestamp", "-"},
+      {"DTIScalarArithmeticDTIColumnNoConvert", "Subtract", "timestamp", "timestamp", "-"},
+      {"DTIColumnArithmeticDTIColumnNoConvert", "Subtract", "timestamp", "timestamp", "-"},
+
+      // The following datetime/interval arithmetic functions require type conversion for one or both operands
+      {"ColumnArithmeticColumnWithConvert", "Subtract", "date", "date", "-", "TimestampUtils.daysToNanoseconds", "TimestampUtils.daysToNanoseconds"},
+      {"ScalarArithmeticColumnWithConvert", "Subtract", "date", "date", "-", "TimestampUtils.daysToNanoseconds", "TimestampUtils.daysToNanoseconds"},
+      {"ColumnArithmeticScalarWithConvert", "Subtract", "date", "date", "-", "TimestampUtils.daysToNanoseconds", "TimestampUtils.daysToNanoseconds"},
+
+      {"ColumnArithmeticColumnWithConvert", "Subtract", "date", "timestamp", "-", "TimestampUtils.daysToNanoseconds", ""},
+      {"ScalarArithmeticColumnWithConvert", "Subtract", "date", "timestamp", "-", "TimestampUtils.daysToNanoseconds", ""},
+      {"ColumnArithmeticScalarWithConvert", "Subtract", "date", "timestamp", "-", "TimestampUtils.daysToNanoseconds", ""},
+
+      {"ColumnArithmeticColumnWithConvert", "Subtract", "timestamp", "date", "-", "", "TimestampUtils.daysToNanoseconds"},
+      {"ScalarArithmeticColumnWithConvert", "Subtract", "timestamp", "date", "-", "", "TimestampUtils.daysToNanoseconds"},
+      {"ColumnArithmeticScalarWithConvert", "Subtract", "timestamp", "date", "-", "", "TimestampUtils.daysToNanoseconds"},
+
+      {"ColumnArithmeticColumnWithConvert", "Add", "date", "interval_day_time", "+", "TimestampUtils.daysToNanoseconds", ""},
+      {"ScalarArithmeticColumnWithConvert", "Add", "date", "interval_day_time", "+", "TimestampUtils.daysToNanoseconds", ""},
+      {"ColumnArithmeticScalarWithConvert", "Add", "date", "interval_day_time", "+", "TimestampUtils.daysToNanoseconds", ""},
+
+      {"ColumnArithmeticColumnWithConvert", "Subtract", "date", "interval_day_time", "-", "TimestampUtils.daysToNanoseconds", ""},
+      {"ScalarArithmeticColumnWithConvert", "Subtract", "date", "interval_day_time", "-", "TimestampUtils.daysToNanoseconds", ""},
+      {"ColumnArithmeticScalarWithConvert", "Subtract", "date", "interval_day_time", "-", "TimestampUtils.daysToNanoseconds", ""},
+
+      {"ColumnArithmeticColumnWithConvert", "Add", "interval_day_time", "date", "+", "", "TimestampUtils.daysToNanoseconds"},
+      {"ScalarArithmeticColumnWithConvert", "Add", "interval_day_time", "date", "+", "", "TimestampUtils.daysToNanoseconds"},
+      {"ColumnArithmeticScalarWithConvert", "Add", "interval_day_time", "date", "+", "", "TimestampUtils.daysToNanoseconds"},
+
+      // Most year-month interval arithmetic needs its own generation
+      {"DateTimeColumnArithmeticIntervalColumnWithConvert", "Add", "date", "interval_year_month", "+", "", "dtm.addMonthsToDays"},
+      {"DateTimeScalarArithmeticIntervalColumnWithConvert", "Add", "date", "interval_year_month", "+", "", "dtm.addMonthsToDays"},
+      {"DateTimeColumnArithmeticIntervalScalarWithConvert", "Add", "date", "interval_year_month", "+", "", "dtm.addMonthsToDays"},
+
+      {"DateTimeColumnArithmeticIntervalColumnWithConvert", "Subtract", "date", "interval_year_month", "-", "", "dtm.addMonthsToDays"},
+      {"DateTimeScalarArithmeticIntervalColumnWithConvert", "Subtract", "date", "interval_year_month", "-", "", "dtm.addMonthsToDays"},
+      {"DateTimeColumnArithmeticIntervalScalarWithConvert", "Subtract", "date", "interval_year_month", "-", "", "dtm.addMonthsToDays"},
+
+      {"DateTimeColumnArithmeticIntervalColumnWithConvert", "Add", "timestamp", "interval_year_month", "+", "", "dtm.addMonthsToNanosUtc"},
+      {"DateTimeScalarArithmeticIntervalColumnWithConvert", "Add", "timestamp", "interval_year_month", "+", "", "dtm.addMonthsToNanosUtc"},
+      {"DateTimeColumnArithmeticIntervalScalarWithConvert", "Add", "timestamp", "interval_year_month", "+", "", "dtm.addMonthsToNanosUtc"},
+
+      {"DateTimeColumnArithmeticIntervalColumnWithConvert", "Subtract", "timestamp", "interval_year_month", "-", "", "dtm.addMonthsToNanosUtc"},
+      {"DateTimeScalarArithmeticIntervalColumnWithConvert", "Subtract", "timestamp", "interval_year_month", "-", "", "dtm.addMonthsToNanosUtc"},
+      {"DateTimeColumnArithmeticIntervalScalarWithConvert", "Subtract", "timestamp", "interval_year_month", "-", "", "dtm.addMonthsToNanosUtc"},
+
+      {"IntervalColumnArithmeticDateTimeColumnWithConvert", "Add", "interval_year_month", "date", "+", "", "dtm.addMonthsToDays"},
+      {"IntervalScalarArithmeticDateTimeColumnWithConvert", "Add", "interval_year_month", "date", "+", "", "dtm.addMonthsToDays"},
+      {"IntervalColumnArithmeticDateTimeScalarWithConvert", "Add", "interval_year_month", "date", "+", "", "dtm.addMonthsToDays"},
+
+      {"IntervalColumnArithmeticDateTimeColumnWithConvert", "Add", "interval_year_month", "timestamp", "+", "", "dtm.addMonthsToNanosUtc"},
+      {"IntervalScalarArithmeticDateTimeColumnWithConvert", "Add", "interval_year_month", "timestamp", "+", "", "dtm.addMonthsToNanosUtc"},
+      {"IntervalColumnArithmeticDateTimeScalarWithConvert", "Add", "interval_year_month", "timestamp", "+", "", "dtm.addMonthsToNanosUtc"},
+
       {"ColumnArithmeticScalar", "Add", "long", "long", "+"},
       {"ColumnArithmeticScalar", "Subtract", "long", "long", "-"},
       {"ColumnArithmeticScalar", "Multiply", "long", "long", "*"},
@@ -528,6 +611,88 @@ public class GenVectorCode extends Task
       {"ColumnCompareColumn", "GreaterEqual", "long", "long", ">="},
       {"ColumnCompareColumn", "GreaterEqual", "double", "long", ">="},
 
+      // Interval comparisons
+      {"DTIScalarCompareColumn", "Equal", "interval_year_month"},
+      {"DTIScalarCompareColumn", "Equal", "interval_day_time"},
+      {"DTIScalarCompareColumn", "NotEqual", "interval_year_month"},
+      {"DTIScalarCompareColumn", "NotEqual", "interval_day_time"},
+      {"DTIScalarCompareColumn", "Less", "interval_year_month"},
+      {"DTIScalarCompareColumn", "Less", "interval_day_time"},
+      {"DTIScalarCompareColumn", "LessEqual", "interval_year_month"},
+      {"DTIScalarCompareColumn", "LessEqual", "interval_day_time"},
+      {"DTIScalarCompareColumn", "Greater", "interval_year_month"},
+      {"DTIScalarCompareColumn", "Greater", "interval_day_time"},
+      {"DTIScalarCompareColumn", "GreaterEqual", "interval_year_month"},
+      {"DTIScalarCompareColumn", "GreaterEqual", "interval_day_time"},
+
+      {"DTIColumnCompareScalar", "Equal", "interval_year_month"},
+      {"DTIColumnCompareScalar", "Equal", "interval_day_time"},
+      {"DTIColumnCompareScalar", "NotEqual", "interval_year_month"},
+      {"DTIColumnCompareScalar", "NotEqual", "interval_day_time"},
+      {"DTIColumnCompareScalar", "Less", "interval_year_month"},
+      {"DTIColumnCompareScalar", "Less", "interval_day_time"},
+      {"DTIColumnCompareScalar", "LessEqual", "interval_year_month"},
+      {"DTIColumnCompareScalar", "LessEqual", "interval_day_time"},
+      {"DTIColumnCompareScalar", "Greater", "interval_year_month"},
+      {"DTIColumnCompareScalar", "Greater", "interval_day_time"},
+      {"DTIColumnCompareScalar", "GreaterEqual", "interval_year_month"},
+      {"DTIColumnCompareScalar", "GreaterEqual", "interval_day_time"},
+
+      {"FilterDTIScalarCompareColumn", "Equal", "interval_year_month"},
+      {"FilterDTIScalarCompareColumn", "Equal", "interval_day_time"},
+      {"FilterDTIScalarCompareColumn", "NotEqual", "interval_year_month"},
+      {"FilterDTIScalarCompareColumn", "NotEqual", "interval_day_time"},
+      {"FilterDTIScalarCompareColumn", "Less", "interval_year_month"},
+      {"FilterDTIScalarCompareColumn", "Less", "interval_day_time"},
+      {"FilterDTIScalarCompareColumn", "LessEqual", "interval_year_month"},
+      {"FilterDTIScalarCompareColumn", "LessEqual", "interval_day_time"},
+      {"FilterDTIScalarCompareColumn", "Greater", "interval_year_month"},
+      {"FilterDTIScalarCompareColumn", "Greater", "interval_day_time"},
+      {"FilterDTIScalarCompareColumn", "GreaterEqual", "interval_year_month"},
+      {"FilterDTIScalarCompareColumn", "GreaterEqual", "interval_day_time"},
+
+      {"FilterDTIColumnCompareScalar", "Equal", "interval_year_month"},
+      {"FilterDTIColumnCompareScalar", "Equal", "interval_day_time"},
+      {"FilterDTIColumnCompareScalar", "NotEqual", "interval_year_month"},
+      {"FilterDTIColumnCompareScalar", "NotEqual", "interval_day_time"},
+      {"FilterDTIColumnCompareScalar", "Less", "interval_year_month"},
+      {"FilterDTIColumnCompareScalar", "Less", "interval_day_time"},
+      {"FilterDTIColumnCompareScalar", "LessEqual", "interval_year_month"},
+      {"FilterDTIColumnCompareScalar", "LessEqual", "interval_day_time"},
+      {"FilterDTIColumnCompareScalar", "Greater", "interval_year_month"},
+      {"FilterDTIColumnCompareScalar", "Greater", "interval_day_time"},
+      {"FilterDTIColumnCompareScalar", "GreaterEqual", "interval_year_month"},
+      {"FilterDTIColumnCompareScalar", "GreaterEqual", "interval_day_time"},
+
+      // Date comparisons
+      {"DTIScalarCompareColumn", "Equal", "date"},
+      {"DTIScalarCompareColumn", "NotEqual", "date"},
+      {"DTIScalarCompareColumn", "Less", "date"},
+      {"DTIScalarCompareColumn", "LessEqual", "date"},
+      {"DTIScalarCompareColumn", "Greater", "date"},
+      {"DTIScalarCompareColumn", "GreaterEqual", "date"},
+
+      {"DTIColumnCompareScalar", "Equal", "date"},
+      {"DTIColumnCompareScalar", "NotEqual", "date"},
+      {"DTIColumnCompareScalar", "Less", "date"},
+      {"DTIColumnCompareScalar", "LessEqual", "date"},
+      {"DTIColumnCompareScalar", "Greater", "date"},
+      {"DTIColumnCompareScalar", "GreaterEqual", "date"},
+
+      {"FilterDTIScalarCompareColumn", "Equal", "date"},
+      {"FilterDTIScalarCompareColumn", "NotEqual", "date"},
+      {"FilterDTIScalarCompareColumn", "Less", "date"},
+      {"FilterDTIScalarCompareColumn", "LessEqual", "date"},
+      {"FilterDTIScalarCompareColumn", "Greater", "date"},
+      {"FilterDTIScalarCompareColumn", "GreaterEqual", "date"},
+
+      {"FilterDTIColumnCompareScalar", "Equal", "date"},
+      {"FilterDTIColumnCompareScalar", "NotEqual", "date"},
+      {"FilterDTIColumnCompareScalar", "Less", "date"},
+      {"FilterDTIColumnCompareScalar", "LessEqual", "date"},
+      {"FilterDTIColumnCompareScalar", "Greater", "date"},
+      {"FilterDTIColumnCompareScalar", "GreaterEqual", "date"},
+
       // template, <ClassNamePrefix>, <ReturnType>, <OperandType>, <FuncName>, <OperandCast>,
       //   <ResultCast>, <Cleanup> <VectorExprArgType>
       {"ColumnUnaryFunc", "FuncRound", "double", "double", "MathExpr.round", "", "", "", ""},
@@ -896,6 +1061,38 @@ public class GenVectorCode extends Task
         generateFilterDecimalScalarCompareColumn(tdesc);
       } else if (tdesc[0].equals("FilterDecimalColumnCompareColumn")) {
         generateFilterDecimalColumnCompareColumn(tdesc);
+      } else if (tdesc[0].equals("FilterDTIScalarCompareColumn")) {
+        generateFilterDTIScalarCompareColumn(tdesc);
+      } else if (tdesc[0].equals("FilterDTIColumnCompareScalar")) {
+        generateFilterDTIColumnCompareScalar(tdesc);
+      } else if (tdesc[0].equals("DTIScalarCompareColumn")) {
+        generateDTIScalarCompareColumn(tdesc);
+      } else if (tdesc[0].equals("DTIColumnCompareScalar")) {
+        generateDTIColumnCompareScalar(tdesc);
+      } else if (tdesc[0].equals("DTIColumnArithmeticDTIScalarNoConvert")) {
+        generateColumnArithmeticScalar(tdesc);
+      } else if (tdesc[0].equals("DTIScalarArithmeticDTIColumnNoConvert")) {
+        generateScalarArithmeticColumn(tdesc);
+      } else if (tdesc[0].equals("DTIColumnArithmeticDTIColumnNoConvert")) {
+        generateColumnArithmeticColumn(tdesc);
+      } else if (tdesc[0].equals("ColumnArithmeticColumnWithConvert")) {
+        generateColumnArithmeticColumnWithConvert(tdesc);
+      } else if (tdesc[0].equals("ScalarArithmeticColumnWithConvert")) {
+        generateScalarArithmeticColumnWithConvert(tdesc);
+      } else if (tdesc[0].equals("ColumnArithmeticScalarWithConvert")) {
+        generateColumnArithmeticScalarWithConvert(tdesc);
+      } else if (tdesc[0].equals("DateTimeColumnArithmeticIntervalColumnWithConvert")) {
+        generateDateTimeColumnArithmeticIntervalColumnWithConvert(tdesc);
+      } else if (tdesc[0].equals("DateTimeScalarArithmeticIntervalColumnWithConvert")) {
+        generateDateTimeScalarArithmeticIntervalColumnWithConvert(tdesc);
+      } else if (tdesc[0].equals("DateTimeColumnArithmeticIntervalScalarWithConvert")) {
+        generateDateTimeColumnArithmeticIntervalScalarWithConvert(tdesc);
+      } else if (tdesc[0].equals("IntervalColumnArithmeticDateTimeColumnWithConvert")) {
+        generateDateTimeColumnArithmeticIntervalColumnWithConvert(tdesc);
+      } else if (tdesc[0].equals("IntervalScalarArithmeticDateTimeColumnWithConvert")) {
+        generateDateTimeScalarArithmeticIntervalColumnWithConvert(tdesc);
+      } else if (tdesc[0].equals("IntervalColumnArithmeticDateTimeScalarWithConvert")) {
+        generateDateTimeColumnArithmeticIntervalScalarWithConvert(tdesc);
       } else {
         continue;
       }
@@ -1324,12 +1521,18 @@ public class GenVectorCode extends Task
     String className = getCamelCaseType(operandType) + "ColUnaryMinus";
         File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
     String templateString = readFile(templateFile);
+    String vectorExprArgType = operandType;
+    if (operandType.equals("long")) {
+      // interval types can use long version
+      vectorExprArgType = "int_interval_family";
+    }
     // Expand, and write result
     templateString = templateString.replaceAll("<ClassName>", className);
     templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
     templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
     templateString = templateString.replaceAll("<OperandType>", operandType);
     templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorExprArgType>", vectorExprArgType);
     writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
         className, templateString);
   }
@@ -1353,7 +1556,7 @@ public class GenVectorCode extends Task
     // Toss in timestamp and date.
     if (operandType.equals("long")) {
       // Let comparisons occur for DATE and TIMESTAMP, too.
-      vectorExprArgType = "int_datetime_family";
+      vectorExprArgType = "int_datetime_interval_family";
     }
     templateString = templateString.replaceAll("<VectorExprArgType>", vectorExprArgType);
 
@@ -1385,8 +1588,8 @@ public class GenVectorCode extends Task
 
     // Toss in timestamp and date.
     if (operandType2.equals("long") && operandType3.equals("long")) {
-      vectorExprArgType2 = "int_datetime_family";
-      vectorExprArgType3 = "int_datetime_family";
+      vectorExprArgType2 = "int_datetime_interval_family";
+      vectorExprArgType3 = "int_datetime_interval_family";
     }
     templateString = templateString.replaceAll("<VectorExprArgType2>", vectorExprArgType2);
     templateString = templateString.replaceAll("<VectorExprArgType3>", vectorExprArgType3);
@@ -1418,8 +1621,8 @@ public class GenVectorCode extends Task
 
     // Toss in timestamp and date.
     if (operandType2.equals("long") && operandType3.equals("long")) {
-      vectorExprArgType2 = "int_datetime_family";
-      vectorExprArgType3 = "int_datetime_family";
+      vectorExprArgType2 = "int_datetime_interval_family";
+      vectorExprArgType3 = "int_datetime_interval_family";
     }
     templateString = templateString.replaceAll("<VectorExprArgType2>", vectorExprArgType2);
     templateString = templateString.replaceAll("<VectorExprArgType3>", vectorExprArgType3);
@@ -1450,8 +1653,8 @@ public class GenVectorCode extends Task
 
     // Toss in timestamp and date.
     if (operandType2.equals("long") && operandType3.equals("long")) {
-      vectorExprArgType2 = "int_datetime_family";
-      vectorExprArgType3 = "int_datetime_family";
+      vectorExprArgType2 = "int_datetime_interval_family";
+      vectorExprArgType3 = "int_datetime_interval_family";
     }
     templateString = templateString.replaceAll("<VectorExprArgType2>", vectorExprArgType2);
     templateString = templateString.replaceAll("<VectorExprArgType3>", vectorExprArgType3);
@@ -1586,8 +1789,8 @@ public class GenVectorCode extends Task
     // But {timestamp|date} and scalar must be handled separately.
     if (operandType1.equals("long") && operandType2.equals("long")) {
       // Let comparisons occur for DATE and TIMESTAMP, too.
-      vectorExprArgType1 = "int_datetime_family";
-      vectorExprArgType2 = "int_datetime_family";
+      vectorExprArgType1 = "int_datetime_interval_family";
+      vectorExprArgType2 = "int_datetime_interval_family";
     }
     templateString = templateString.replaceAll("<VectorExprArgType1>", vectorExprArgType1);
     templateString = templateString.replaceAll("<VectorExprArgType2>", vectorExprArgType2);
@@ -1738,6 +1941,7 @@ public class GenVectorCode extends Task
 
   private void generateColumnArithmeticOperatorColumn(String[] tdesc, String returnType,
          String className) throws Exception {
+    String operatorName = tdesc[1];
     String operandType1 = tdesc[2];
     String operandType2 = tdesc[3];
     String outputColumnVectorType = this.getColumnVectorType(returnType);
@@ -1752,6 +1956,7 @@ public class GenVectorCode extends Task
     templateString = templateString.replaceAll("<InputColumnVectorType1>", inputColumnVectorType1);
     templateString = templateString.replaceAll("<InputColumnVectorType2>", inputColumnVectorType2);
     templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
     templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
     templateString = templateString.replaceAll("<OperandType1>", operandType1);
     templateString = templateString.replaceAll("<OperandType2>", operandType2);
@@ -1813,6 +2018,7 @@ public class GenVectorCode extends Task
 
   private void generateColumnArithmeticOperatorScalar(String[] tdesc, String returnType,
      String className) throws Exception {
+    String operatorName = tdesc[1];
     String operandType1 = tdesc[2];
     String operandType2 = tdesc[3];
     String outputColumnVectorType = this.getColumnVectorType(returnType);
@@ -1825,6 +2031,7 @@ public class GenVectorCode extends Task
     templateString = templateString.replaceAll("<ClassName>", className);
     templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
     templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
     templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
     templateString = templateString.replaceAll("<OperandType1>", operandType1);
     templateString = templateString.replaceAll("<OperandType2>", operandType2);
@@ -1832,12 +2039,17 @@ public class GenVectorCode extends Task
     writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
         className, templateString);
 
+    String testScalarType = operandType2;
+    if (isDateTimeIntervalType(testScalarType)) {
+      testScalarType = "long";
+    }
+
     testCodeGen.addColumnScalarOperationTestCases(
           true,
           className,
           inputColumnVectorType,
           outputColumnVectorType,
-          operandType2);
+          testScalarType);
   }
 
   private void generateScalarCompareOperatorColumn(String[] tdesc, boolean filter,
@@ -1886,6 +2098,7 @@ public class GenVectorCode extends Task
 
   private void generateScalarArithmeticOperatorColumn(String[] tdesc, String returnType,
      String className) throws Exception {
+     String operatorName = tdesc[1];
      String operandType1 = tdesc[2];
      String operandType2 = tdesc[3];
      String outputColumnVectorType = this.getColumnVectorType(
@@ -1899,6 +2112,7 @@ public class GenVectorCode extends Task
      templateString = templateString.replaceAll("<ClassName>", className);
      templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
      templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+     templateString = templateString.replaceAll("<OperatorName>", operatorName);
      templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
      templateString = templateString.replaceAll("<OperandType1>", operandType1);
      templateString = templateString.replaceAll("<OperandType2>", operandType2);
@@ -1907,12 +2121,17 @@ public class GenVectorCode extends Task
      writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
         className, templateString);
 
+     String testScalarType = operandType1;
+     if (isDateTimeIntervalType(testScalarType)) {
+       testScalarType = "long";
+     }
+
      testCodeGen.addColumnScalarOperationTestCases(
            false,
            className,
            inputColumnVectorType,
            outputColumnVectorType,
-           operandType1);
+           testScalarType);
   }
 
   //Binary arithmetic operator
@@ -2053,6 +2272,378 @@ public class GenVectorCode extends Task
         className, templateString);
   }
 
+  // TODO: These can eventually be used to replace generateTimestampScalarCompareTimestampColumn()
+  private void generateDTIScalarCompareColumn(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType = tdesc[2];
+    String className = getCamelCaseType(operandType) + "Scalar" + operatorName
+        + getCamelCaseType(operandType) + "Column";
+    String baseClassName = "LongScalar" + operatorName + "LongColumn";
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<BaseClassName>", baseClassName);
+    templateString = templateString.replaceAll("<VectorExprArgType>", operandType);
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+  }
+
+  private void generateFilterDTIScalarCompareColumn(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType = tdesc[2];
+    String className = "Filter" + getCamelCaseType(operandType) + "Scalar" + operatorName
+        + getCamelCaseType(operandType) + "Column";
+    String baseClassName = "FilterLongScalar" + operatorName + "LongColumn";
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<BaseClassName>", baseClassName);
+    templateString = templateString.replaceAll("<VectorExprArgType>", operandType);
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+  }
+
+  private void generateDTIColumnCompareScalar(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType = tdesc[2];
+    String className = getCamelCaseType(operandType) + "Col" + operatorName
+        + getCamelCaseType(operandType) + "Scalar";
+    String baseClassName = "LongCol" + operatorName + "LongScalar";
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<BaseClassName>", baseClassName);
+    templateString = templateString.replaceAll("<VectorExprArgType>", operandType);
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+  }
+
+  private void generateFilterDTIColumnCompareScalar(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType = tdesc[2];
+    String className = "Filter" + getCamelCaseType(operandType) + "Col" + operatorName
+        + getCamelCaseType(operandType) + "Scalar";
+    String baseClassName = "FilterLongCol" + operatorName + "LongScalar";
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<BaseClassName>", baseClassName);
+    templateString = templateString.replaceAll("<VectorExprArgType>", operandType);
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+  }
+
+  private void generateColumnArithmeticColumnWithConvert(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType1 = tdesc[2];
+    String operandType2 = tdesc[3];
+    String operatorSymbol = tdesc[4];
+    String typeConversion1 = tdesc[5];
+    String typeConversion2 = tdesc[6];
+    String className = getCamelCaseType(operandType1)
+        + "Col" + operatorName + getCamelCaseType(operandType2) + "Column";
+    String returnType = getArithmeticReturnType(operandType1, operandType2);
+    String outputColumnVectorType = this.getColumnVectorType(returnType);
+    String inputColumnVectorType1 = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType2 = this.getColumnVectorType(operandType2);
+    // For date/timestamp/interval, this should be "long"
+    String vectorOperandType1 = this.getVectorPrimitiveType(inputColumnVectorType1);
+    String vectorOperandType2 = this.getVectorPrimitiveType(inputColumnVectorType2);
+    String vectorReturnType = this.getVectorPrimitiveType(outputColumnVectorType);
+
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<InputColumnVectorType1>", inputColumnVectorType1);
+    templateString = templateString.replaceAll("<InputColumnVectorType2>", inputColumnVectorType2);
+    templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
+    templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
+    templateString = templateString.replaceAll("<OperandType1>", operandType1);
+    templateString = templateString.replaceAll("<OperandType2>", operandType2);
+    templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorOperandType1>", vectorOperandType1);
+    templateString = templateString.replaceAll("<VectorOperandType2>", vectorOperandType2);
+    templateString = templateString.replaceAll("<VectorReturnType>", vectorReturnType);
+    templateString = templateString.replaceAll("<TypeConversion1>", typeConversion1);
+    templateString = templateString.replaceAll("<TypeConversion2>", typeConversion2);
+    templateString = templateString.replaceAll("<CamelReturnType>", getCamelCaseType(vectorReturnType));
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+
+    testCodeGen.addColumnColumnOperationTestCases(
+          className,
+          inputColumnVectorType1,
+          inputColumnVectorType2,
+          outputColumnVectorType);
+  }
+
+  private void generateScalarArithmeticColumnWithConvert(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType1 = tdesc[2];
+    String operandType2 = tdesc[3];
+    String operatorSymbol = tdesc[4];
+    String typeConversion1 = tdesc[5];
+    String typeConversion2 = tdesc[6];
+    String className = getCamelCaseType(operandType1)
+        + "Scalar" + operatorName + getCamelCaseType(operandType2) + "Column";
+    String returnType = getArithmeticReturnType(operandType1, operandType2);
+    String outputColumnVectorType = this.getColumnVectorType(
+        returnType == null ? "long" : returnType);
+    String inputColumnVectorType = this.getColumnVectorType(operandType2);
+    String inputColumnVectorType1 = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType2 = this.getColumnVectorType(operandType2);
+    // For date/timestamp/interval, this should be "long"
+    String vectorOperandType1 = this.getVectorPrimitiveType(inputColumnVectorType1);
+    String vectorOperandType2 = this.getVectorPrimitiveType(inputColumnVectorType2);
+    String vectorReturnType = this.getVectorPrimitiveType(outputColumnVectorType);
+
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
+    templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
+    templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
+    templateString = templateString.replaceAll("<OperandType1>", operandType1);
+    templateString = templateString.replaceAll("<OperandType2>", operandType2);
+    templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorOperandType1>", vectorOperandType1);
+    templateString = templateString.replaceAll("<VectorOperandType2>", vectorOperandType2);
+    templateString = templateString.replaceAll("<VectorReturnType>", vectorReturnType);
+    templateString = templateString.replaceAll("<TypeConversion1>", typeConversion1);
+    templateString = templateString.replaceAll("<TypeConversion2>", typeConversion2);
+    templateString = templateString.replaceAll("<CamelReturnType>", getCamelCaseType(vectorReturnType));
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+       className, templateString);
+
+    String testScalarType = operandType1;
+    if (isDateTimeIntervalType(testScalarType)) {
+      testScalarType = "long";
+    }
+
+    testCodeGen.addColumnScalarOperationTestCases(
+          false,
+          className,
+          inputColumnVectorType,
+          outputColumnVectorType,
+          testScalarType);
+  }
+
+  private void generateColumnArithmeticScalarWithConvert(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType1 = tdesc[2];
+    String operandType2 = tdesc[3];
+    String operatorSymbol = tdesc[4];
+    String typeConversion1 = tdesc[5];
+    String typeConversion2 = tdesc[6];
+    String className = getCamelCaseType(operandType1)
+        + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar";
+    String returnType = getArithmeticReturnType(operandType1, operandType2);
+    String outputColumnVectorType = this.getColumnVectorType(returnType);
+    String inputColumnVectorType = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType1 = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType2 = this.getColumnVectorType(operandType2);
+    // For date/timestamp/interval, this should be "long"
+    String vectorOperandType1 = this.getVectorPrimitiveType(inputColumnVectorType1);
+    String vectorOperandType2 = this.getVectorPrimitiveType(inputColumnVectorType2);
+    String vectorReturnType = this.getVectorPrimitiveType(outputColumnVectorType);
+
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
+    templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
+    templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
+    templateString = templateString.replaceAll("<OperandType1>", operandType1);
+    templateString = templateString.replaceAll("<OperandType2>", operandType2);
+    templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorOperandType1>", vectorOperandType1);
+    templateString = templateString.replaceAll("<VectorOperandType2>", vectorOperandType2);
+    templateString = templateString.replaceAll("<VectorReturnType>", vectorReturnType);
+    templateString = templateString.replaceAll("<TypeConversion1>", typeConversion1);
+    templateString = templateString.replaceAll("<TypeConversion2>", typeConversion2);
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+
+    String testScalarType = operandType2;
+    if (isDateTimeIntervalType(testScalarType)) {
+      testScalarType = "long";
+    }
+
+    testCodeGen.addColumnScalarOperationTestCases(
+          true,
+          className,
+          inputColumnVectorType,
+          outputColumnVectorType,
+          testScalarType);
+  }
+
+  private void generateDateTimeColumnArithmeticIntervalColumnWithConvert(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType1 = tdesc[2];
+    String operandType2 = tdesc[3];
+    String operatorSymbol = tdesc[4];
+    String typeConversion = tdesc[5];
+    String operatorFunction = tdesc[6];
+    String className = getCamelCaseType(operandType1)
+        + "Col" + operatorName + getCamelCaseType(operandType2) + "Column";
+    String returnType = getArithmeticReturnType(operandType1, operandType2);
+    String outputColumnVectorType = this.getColumnVectorType(returnType);
+    String inputColumnVectorType1 = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType2 = this.getColumnVectorType(operandType2);
+    // For date/timestamp/interval, this should be "long"
+    String vectorOperandType1 = this.getVectorPrimitiveType(inputColumnVectorType1);
+    String vectorOperandType2 = this.getVectorPrimitiveType(inputColumnVectorType2);
+    String vectorReturnType = this.getVectorPrimitiveType(outputColumnVectorType);
+
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<InputColumnVectorType1>", inputColumnVectorType1);
+    templateString = templateString.replaceAll("<InputColumnVectorType2>", inputColumnVectorType2);
+    templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
+    templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
+    templateString = templateString.replaceAll("<OperandType1>", operandType1);
+    templateString = templateString.replaceAll("<OperandType2>", operandType2);
+    templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorOperandType1>", vectorOperandType1);
+    templateString = templateString.replaceAll("<VectorOperandType2>", vectorOperandType2);
+    templateString = templateString.replaceAll("<VectorReturnType>", vectorReturnType);
+    templateString = templateString.replaceAll("<TypeConversionToMillis>", typeConversion);
+    templateString = templateString.replaceAll("<OperatorFunction>", operatorFunction);
+    templateString = templateString.replaceAll("<CamelReturnType>", getCamelCaseType(vectorReturnType));
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+
+    testCodeGen.addColumnColumnOperationTestCases(
+          className,
+          inputColumnVectorType1,
+          inputColumnVectorType2,
+          outputColumnVectorType);
+  }
+
+  private void generateDateTimeScalarArithmeticIntervalColumnWithConvert(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType1 = tdesc[2];
+    String operandType2 = tdesc[3];
+    String operatorSymbol = tdesc[4];
+    String typeConversion = tdesc[5];
+    String operatorFunction = tdesc[6];
+    String className = getCamelCaseType(operandType1)
+        + "Scalar" + operatorName + getCamelCaseType(operandType2) + "Column";
+    String returnType = getArithmeticReturnType(operandType1, operandType2);
+    String outputColumnVectorType = this.getColumnVectorType(
+        returnType == null ? "long" : returnType);
+    String inputColumnVectorType = this.getColumnVectorType(operandType2);
+    String inputColumnVectorType1 = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType2 = this.getColumnVectorType(operandType2);
+    // For date/timestamp/interval, this should be "long"
+    String vectorOperandType1 = this.getVectorPrimitiveType(inputColumnVectorType1);
+    String vectorOperandType2 = this.getVectorPrimitiveType(inputColumnVectorType2);
+    String vectorReturnType = this.getVectorPrimitiveType(outputColumnVectorType);
+
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
+    templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
+    templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
+    templateString = templateString.replaceAll("<OperandType1>", operandType1);
+    templateString = templateString.replaceAll("<OperandType2>", operandType2);
+    templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorOperandType1>", vectorOperandType1);
+    templateString = templateString.replaceAll("<VectorOperandType2>", vectorOperandType2);
+    templateString = templateString.replaceAll("<VectorReturnType>", vectorReturnType);
+    templateString = templateString.replaceAll("<TypeConversionToMillis>", typeConversion);
+    templateString = templateString.replaceAll("<OperatorFunction>", operatorFunction);
+    templateString = templateString.replaceAll("<CamelReturnType>", getCamelCaseType(vectorReturnType));
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+       className, templateString);
+
+    String testScalarType = operandType1;
+    if (isDateTimeIntervalType(testScalarType)) {
+      testScalarType = "long";
+    }
+
+    testCodeGen.addColumnScalarOperationTestCases(
+          false,
+          className,
+          inputColumnVectorType,
+          outputColumnVectorType,
+          testScalarType);
+  }
+
+  private void generateDateTimeColumnArithmeticIntervalScalarWithConvert(String[] tdesc) throws Exception {
+    String operatorName = tdesc[1];
+    String operandType1 = tdesc[2];
+    String operandType2 = tdesc[3];
+    String operatorSymbol = tdesc[4];
+    String typeConversion = tdesc[5];
+    String operatorFunction = tdesc[6];
+    String className = getCamelCaseType(operandType1)
+        + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar";
+    String returnType = getArithmeticReturnType(operandType1, operandType2);
+    String outputColumnVectorType = this.getColumnVectorType(returnType);
+    String inputColumnVectorType = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType1 = this.getColumnVectorType(operandType1);
+    String inputColumnVectorType2 = this.getColumnVectorType(operandType2);
+    // For date/timestamp/interval, this should be "long"
+    String vectorOperandType1 = this.getVectorPrimitiveType(inputColumnVectorType1);
+    String vectorOperandType2 = this.getVectorPrimitiveType(inputColumnVectorType2);
+    String vectorReturnType = this.getVectorPrimitiveType(outputColumnVectorType);
+
+    //Read the template into a string;
+    File templateFile = new File(joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"));
+    String templateString = readFile(templateFile);
+    templateString = templateString.replaceAll("<ClassName>", className);
+    templateString = templateString.replaceAll("<InputColumnVectorType>", inputColumnVectorType);
+    templateString = templateString.replaceAll("<OutputColumnVectorType>", outputColumnVectorType);
+    templateString = templateString.replaceAll("<OperatorName>", operatorName);
+    templateString = templateString.replaceAll("<OperatorSymbol>", operatorSymbol);
+    templateString = templateString.replaceAll("<OperandType1>", operandType1);
+    templateString = templateString.replaceAll("<OperandType2>", operandType2);
+    templateString = templateString.replaceAll("<ReturnType>", returnType);
+    templateString = templateString.replaceAll("<VectorOperandType1>", vectorOperandType1);
+    templateString = templateString.replaceAll("<VectorOperandType2>", vectorOperandType2);
+    templateString = templateString.replaceAll("<VectorReturnType>", vectorReturnType);
+    templateString = templateString.replaceAll("<TypeConversionToMillis>", typeConversion);
+    templateString = templateString.replaceAll("<OperatorFunction>", operatorFunction);
+    writeFile(templateFile.lastModified(), expressionOutputDirectory, expressionClassesDirectory,
+        className, templateString);
+
+    String testScalarType = operandType2;
+    if (isDateTimeIntervalType(testScalarType)) {
+      testScalarType = "long";
+    }
+
+    testCodeGen.addColumnScalarOperationTestCases(
+          true,
+          className,
+          inputColumnVectorType,
+          outputColumnVectorType,
+          testScalarType);
+  }
+
+  private static boolean isDateTimeIntervalType(String type) {
+    return (type.equals("date")
+        || type.equals("timestamp")
+        || type.equals("interval_year_month")
+        || type.equals("interval_day_time"));
+  }
+
   static void writeFile(long templateTime, String outputDir, String classesDir,
        String className, String str) throws IOException {
     File outputFile = new File(outputDir, className + ".java");
@@ -2098,6 +2689,14 @@ public class GenVectorCode extends Task
       return "Double";
     } else if (type.equals("decimal")) {
       return "Decimal";
+    } else if (type.equals("interval_year_month")) {
+      return "IntervalYearMonth";
+    } else if (type.equals("interval_day_time")) {
+      return "IntervalDayTime";
+    } else if (type.equals("timestamp")) {
+      return "Timestamp";
+    } else if (type.equals("date")) {
+      return "Date";
     } else {
       return type;
     }
@@ -2111,20 +2710,60 @@ public class GenVectorCode extends Task
     return firstLetterAsCap + word.substring(1);
   }
 
+  private static final String ARITHMETIC_RETURN_TYPES[][] = {
+    { "interval_year_month", "interval_year_month", "interval_year_month"},
+    { "interval_year_month", "date", "date"},
+    { "date", "interval_year_month", "date"},
+    { "interval_year_month", "timestamp", "timestamp"},
+    { "timestamp", "interval_year_month", "timestamp"},
+    { "interval_day_time", "interval_day_time", "interval_day_time"},
+    { "interval_day_time", "date", "timestamp"},
+    { "date", "interval_day_time", "timestamp"},
+    { "interval_day_time", "timestamp", "timestamp"},
+    { "timestamp", "interval_day_time", "timestamp"},
+    { "date", "date", "interval_day_time"},
+    { "timestamp", "timestamp", "interval_day_time"},
+    { "timestamp", "date", "interval_day_time"},
+    { "date", "timestamp", "interval_day_time"},
+    { "*", "double", "double"},
+    { "double", "*", "double"},
+  };
+
   private String getArithmeticReturnType(String operandType1,
       String operandType2) {
+/*
     if (operandType1.equals("double") ||
         operandType2.equals("double")) {
       return "double";
+    } else if (operandType1.equals("interval_year_month") &&
+        operandType2.equals("interval_year_month")) {
+      return "interval_year_month";
+    } else if (operandType1.equals("interval_year_month") &&
+        operandType2.equals("date")) {
+      return "date";
+    } else if (operandType1.equals("date") &&
+        operandType2.equals("interval_year_month")) {
+      return "date";
+    } else if (operandType1.equals("interval_day_time") &&
+        operandType2.equals("interval_day_time")) {
+      return "interval_day_time";
     } else {
       return "long";
     }
+*/
+    for (String[] combination : ARITHMETIC_RETURN_TYPES) {
+      if ((combination[0].equals("*") || combination[0].equals(operandType1)) &&
+          (combination[1].equals("*") || combination[1].equals(operandType2))) {
+        return combination[2];
+      }
+    }
+    return "long";
   }
 
   private String getColumnVectorType(String primitiveType) throws Exception {
     if(primitiveType.equals("double")) {
       return "DoubleColumnVector";
-    } else if (primitiveType.equals("long")) {
+    } else if (primitiveType.equals("long") || isDateTimeIntervalType(primitiveType)) {
         return "LongColumnVector";
     } else if (primitiveType.equals("decimal")) {
         return "DecimalColumnVector";
@@ -2134,6 +2773,19 @@ public class GenVectorCode extends Task
     throw new Exception("Unimplemented primitive column vector type: " + primitiveType);
   }
 
+  private String getVectorPrimitiveType(String columnVectorType) throws Exception {
+    if (columnVectorType.equals("LongColumnVector")) {
+      return "long";
+    } else if (columnVectorType.equals("double")) {
+      return "double";
+    } else if (columnVectorType.equals("DecimalColumnVector")) {
+      return "decimal";
+    } else if (columnVectorType.equals("BytesColumnVector")) {
+      return "string";
+    }
+    throw new Exception("Could not determine primitive type for column vector type: " + columnVectorType);
+  }
+
   private String getOutputWritableType(String primitiveType) throws Exception {
     if (primitiveType.equals("long")) {
       return "LongWritable";
@@ -2141,6 +2793,14 @@ public class GenVectorCode extends Task
       return "DoubleWritable";
     } else if (primitiveType.equals("decimal")) {
       return "HiveDecimalWritable";
+    } else if (primitiveType.equals("interval_year_month")) {
+      return "HiveIntervalYearMonthWritable";
+    } else if (primitiveType.equals("interval_day_time")) {
+      return "HiveIntervalDayTimeWritable";
+    } else if (primitiveType.equals("date")) {
+      return "HiveDateWritable";
+    } else if (primitiveType.equals("timestamp")) {
+      return "HiveTimestampWritable";
     }
     throw new Exception("Unimplemented primitive output writable: " + primitiveType);
   }
@@ -2152,6 +2812,14 @@ public class GenVectorCode extends Task
       return "PrimitiveObjectInspectorFactory.writableDoubleObjectInspector";
     } else if (primitiveType.equals("decimal")) {
       return "PrimitiveObjectInspectorFactory.writableHiveDecimalObjectInspector";
+    } else if (primitiveType.equals("interval_year_month")) {
+      return "PrimitiveObjectInspectorFactory.writableHiveIntervalYearMonthObjectInspector";
+    } else if (primitiveType.equals("interval_day_time")) {
+      return "PrimitiveObjectInspectorFactory.writableHiveIntervalDayTimeObjectInspector";
+    } else if (primitiveType.equals("date")) {
+      return "PrimitiveObjectInspectorFactory.writableDateObjectInspector";
+    } else if (primitiveType.equals("timestamp")) {
+      return "PrimitiveObjectInspectorFactory.writableTimestampObjectInspector";
     }
     throw new Exception("Unimplemented primitive output inspector: " + primitiveType);
   }

Modified: hive/branches/spark/beeline/src/java/org/apache/hive/beeline/BeeLine.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/beeline/src/java/org/apache/hive/beeline/BeeLine.java?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/beeline/src/java/org/apache/hive/beeline/BeeLine.java (original)
+++ hive/branches/spark/beeline/src/java/org/apache/hive/beeline/BeeLine.java Sat Mar 28 14:03:43 2015
@@ -803,10 +803,14 @@ public class BeeLine implements Closeabl
   }
 
   private int execute(ConsoleReader reader, boolean exitOnError) {
+    String line;
     while (!exit) {
       try {
         // Execute one instruction; terminate on executing a script if there is an error
-        if (!dispatch(reader.readLine(getPrompt())) && exitOnError) {
+        // in silent mode, prevent the query and prompt being echoed back to terminal
+        line = getOpts().isSilent() ? reader.readLine(null, ConsoleReader.NULL_MASK) : reader.readLine(getPrompt());
+
+        if (!dispatch(line) && exitOnError) {
           return ERRNO_OTHER;
         }
       } catch (Throwable t) {

Modified: hive/branches/spark/beeline/src/java/org/apache/hive/beeline/Commands.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/beeline/src/java/org/apache/hive/beeline/Commands.java?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/beeline/src/java/org/apache/hive/beeline/Commands.java (original)
+++ hive/branches/spark/beeline/src/java/org/apache/hive/beeline/Commands.java Sat Mar 28 14:03:43 2015
@@ -768,6 +768,9 @@ public class Commands {
         }
 
         String extra = beeLine.getConsoleReader().readLine(prompt.toString());
+        if (extra == null) { //it happens when using -f and the line of cmds does not end with ;
+          break;
+        }
         if (!beeLine.isComment(extra)) {
           line += "\n" + extra;
         }
@@ -776,100 +779,104 @@ public class Commands {
       beeLine.handleException(e);
     }
 
-    line = line.trim();
-    if (line.endsWith(";")) {
-      line = line.substring(0, line.length() - 1);
-    }
-
     if (!(beeLine.assertConnection())) {
       return false;
     }
 
-    String sql = line;
-
-    if (sql.startsWith(BeeLine.COMMAND_PREFIX)) {
-      sql = sql.substring(1);
-    }
-
-    String prefix = call ? "call" : "sql";
-
-    if (sql.startsWith(prefix)) {
-      sql = sql.substring(prefix.length());
-    }
-
-    // batch statements?
-    if (beeLine.getBatch() != null) {
-      beeLine.getBatch().add(sql);
-      return true;
-    }
-
-    try {
-      Statement stmnt = null;
-      boolean hasResults;
-      Thread logThread = null;
-
-      try {
-        long start = System.currentTimeMillis();
-
-        if (call) {
-          stmnt = beeLine.getDatabaseConnection().getConnection().prepareCall(sql);
-          hasResults = ((CallableStatement) stmnt).execute();
-        } else {
-          stmnt = beeLine.createStatement();
-          if (beeLine.getOpts().isSilent()) {
-            hasResults = stmnt.execute(sql);
-          } else {
-            logThread = new Thread(createLogRunnable(stmnt));
-            logThread.setDaemon(true);
-            logThread.start();
-            hasResults = stmnt.execute(sql);
-            logThread.interrupt();
-            logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
-          }
-        }
+    line = line.trim();
+    String[] cmds = line.split(";");
+    for (int i = 0; i < cmds.length; i++) {
+      String sql = cmds[i].trim();
+      if (sql.length() != 0) {
+        if (beeLine.isComment(sql)) {
+          //skip this and rest cmds in the line
+          break;
+        }
+        if (sql.startsWith(BeeLine.COMMAND_PREFIX)) {
+          sql = sql.substring(1);
+        }
+
+        String prefix = call ? "call" : "sql";
+
+        if (sql.startsWith(prefix)) {
+          sql = sql.substring(prefix.length());
+        }
+
+        // batch statements?
+        if (beeLine.getBatch() != null) {
+          beeLine.getBatch().add(sql);
+          continue;
+        }
+
+        try {
+          Statement stmnt = null;
+          boolean hasResults;
+          Thread logThread = null;
+
+          try {
+            long start = System.currentTimeMillis();
+
+            if (call) {
+              stmnt = beeLine.getDatabaseConnection().getConnection().prepareCall(sql);
+              hasResults = ((CallableStatement) stmnt).execute();
+            } else {
+              stmnt = beeLine.createStatement();
+              if (beeLine.getOpts().isSilent()) {
+                hasResults = stmnt.execute(sql);
+              } else {
+                logThread = new Thread(createLogRunnable(stmnt));
+                logThread.setDaemon(true);
+                logThread.start();
+                hasResults = stmnt.execute(sql);
+                logThread.interrupt();
+                logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
+              }
+            }
 
-        beeLine.showWarnings();
+            beeLine.showWarnings();
 
-        if (hasResults) {
-          do {
-            ResultSet rs = stmnt.getResultSet();
-            try {
-              int count = beeLine.print(rs);
+            if (hasResults) {
+              do {
+                ResultSet rs = stmnt.getResultSet();
+                try {
+                  int count = beeLine.print(rs);
+                  long end = System.currentTimeMillis();
+
+                  beeLine.info(beeLine.loc("rows-selected", count) + " "
+                      + beeLine.locElapsedTime(end - start));
+                } finally {
+                  if (logThread != null) {
+                    logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
+                    showRemainingLogsIfAny(stmnt);
+                    logThread = null;
+                  }
+                  rs.close();
+                }
+              } while (BeeLine.getMoreResults(stmnt));
+            } else {
+              int count = stmnt.getUpdateCount();
               long end = System.currentTimeMillis();
-
-              beeLine.info(beeLine.loc("rows-selected", count) + " "
-                  + beeLine.locElapsedTime(end - start));
-            } finally {
-              if (logThread != null) {
-                logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
-                showRemainingLogsIfAny(stmnt);
-                logThread = null;
+              beeLine.info(beeLine.loc("rows-affected", count)
+                  + " " + beeLine.locElapsedTime(end - start));
+            }
+          } finally {
+            if (logThread != null) {
+              if (!logThread.isInterrupted()) {
+                logThread.interrupt();
               }
-              rs.close();
+              logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
+              showRemainingLogsIfAny(stmnt);
+            }
+            if (stmnt != null) {
+              stmnt.close();
             }
-          } while (BeeLine.getMoreResults(stmnt));
-        } else {
-          int count = stmnt.getUpdateCount();
-          long end = System.currentTimeMillis();
-          beeLine.info(beeLine.loc("rows-affected", count)
-              + " " + beeLine.locElapsedTime(end - start));
-        }
-      } finally {
-        if (logThread != null) {
-          if (!logThread.isInterrupted()) {
-            logThread.interrupt();
           }
-          logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
-          showRemainingLogsIfAny(stmnt);
-        }
-        if (stmnt != null) {
-          stmnt.close();
+        } catch (Exception e) {
+          return beeLine.error(e);
         }
+        beeLine.showWarnings();
       }
-    } catch (Exception e) {
-      return beeLine.error(e);
     }
-    beeLine.showWarnings();
     return true;
   }
 

Modified: hive/branches/spark/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (original)
+++ hive/branches/spark/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java Sat Mar 28 14:03:43 2015
@@ -710,6 +710,11 @@ public class HiveConf extends Configurat
     HIVEMAPJOINUSEOPTIMIZEDTABLE("hive.mapjoin.optimized.hashtable", true,
         "Whether Hive should use memory-optimized hash table for MapJoin. Only works on Tez,\n" +
         "because memory-optimized hashtable cannot be serialized."),
+    HIVEUSEHYBRIDGRACEHASHJOIN("hive.mapjoin.hybridgrace.hashtable", false, "Whether to use hybrid" +
+        "grace hash join as the join method for mapjoin."),
+    HIVEHYBRIDGRACEHASHJOINMEMCHECKFREQ("hive.mapjoin.hybridgrace.memcheckfrequency", 1024, "For " +
+        "hybrid grace hash join, how often (how many rows apart) we check if memory is full. " +
+        "This number should be power of 2."),
     HIVEHASHTABLEWBSIZE("hive.mapjoin.optimized.hashtable.wbsize", 10 * 1024 * 1024,
         "Optimized hashtable (see hive.mapjoin.optimized.hashtable) uses a chain of buffers to\n" +
         "store data. This is one buffer size. HT may be slightly faster if this is larger, but for small\n" +
@@ -766,6 +771,11 @@ public class HiveConf extends Configurat
 
     HIVEDEFAULTFILEFORMAT("hive.default.fileformat", "TextFile", new StringSet("TextFile", "SequenceFile", "RCfile", "ORC"),
         "Default file format for CREATE TABLE statement. Users can explicitly override it by CREATE TABLE ... STORED AS [FORMAT]"),
+    HIVEDEFAULTMANAGEDFILEFORMAT("hive.default.fileformat.managed", "none",
+	new StringSet("none", "TextFile", "SequenceFile", "RCfile", "ORC"),
+	"Default file format for CREATE TABLE statement applied to managed tables only. External tables will be \n" +
+	"created with format specified by hive.default.fileformat. Leaving this null will result in using hive.default.fileformat \n" +
+	"for all tables."),
     HIVEQUERYRESULTFILEFORMAT("hive.query.result.fileformat", "TextFile", new StringSet("TextFile", "SequenceFile", "RCfile"),
         "Default file format for storing result of the query."),
     HIVECHECKFILEFORMAT("hive.fileformat.check", true, "Whether to check file format or not when loading data files"),
@@ -1954,7 +1964,9 @@ public class HiveConf extends Configurat
         "  none: default(past) behavior. Implies only alphaNumeric and underscore are valid characters in identifiers.\n" +
         "  column: implies column names can contain any character."
     ),
-
+    HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS("hive.support.sql11.reserved.keywords", true,
+        "This flag should be set to true to enable support for SQL2011 reserved keywords.\n" +
+        "The default value is true."),
     // role names are case-insensitive
     USERS_IN_ADMIN_ROLE("hive.users.in.admin.role", "", false,
         "Comma separated list of users who are in admin role for bootstrapping.\n" +
@@ -2027,7 +2039,11 @@ public class HiveConf extends Configurat
     SPARK_RPC_CHANNEL_LOG_LEVEL("hive.spark.client.channel.log.level", null,
       "Channel logging level for remote Spark driver.  One of {DEBUG, ERROR, INFO, TRACE, WARN}."),
     SPARK_RPC_SASL_MECHANISM("hive.spark.client.rpc.sasl.mechanisms", "DIGEST-MD5",
-      "Name of the SASL mechanism to use for authentication.");
+      "Name of the SASL mechanism to use for authentication."),
+    NWAYJOINREORDER("hive.reorder.nway.joins", true,
+      "Runs reordering of tables within single n-way join (i.e.: picks streamtable)"),
+    HIVE_LOG_N_RECORDS("hive.log.every.n.records", 0L, new RangeValidator(0L, null),
+      "If value is greater than 0 logs in fixed intervals of size n rather than exponentially.");
 
     public final String varname;
     private final String defaultExpr;

Modified: hive/branches/spark/common/src/java/org/apache/hive/common/util/DateUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/common/src/java/org/apache/hive/common/util/DateUtils.java?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/common/src/java/org/apache/hive/common/util/DateUtils.java (original)
+++ hive/branches/spark/common/src/java/org/apache/hive/common/util/DateUtils.java Sat Mar 28 14:03:43 2015
@@ -18,8 +18,11 @@
 
 package org.apache.hive.common.util;
 
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+
 /**
  * DateUtils. Thread-safe class
  *
@@ -36,4 +39,31 @@ public class DateUtils {
   public static SimpleDateFormat getDateFormat() {
     return dateFormatLocal.get();
   }
-}
\ No newline at end of file
+
+  public static final int NANOS_PER_SEC = 1000000000;
+  public static final BigDecimal MAX_INT_BD = new BigDecimal(Integer.MAX_VALUE);
+  public static final BigDecimal NANOS_PER_SEC_BD = new BigDecimal(NANOS_PER_SEC);
+
+  public static int parseNumericValueWithRange(String fieldName,
+      String strVal, int minValue, int maxValue) throws IllegalArgumentException {
+    int result = 0;
+    if (strVal != null) {
+      result = Integer.parseInt(strVal);
+      if (result < minValue || result > maxValue) {
+        throw new IllegalArgumentException(String.format("%s value %d outside range [%d, %d]",
+            fieldName, result, minValue, maxValue));
+      }
+    }
+    return result;
+  }
+
+  public static long getIntervalDayTimeTotalNanos(HiveIntervalDayTime intervalDayTime) {
+    return intervalDayTime.getTotalSeconds() * NANOS_PER_SEC + intervalDayTime.getNanos();
+  }
+
+  public static void setIntervalDayTimeTotalNanos(HiveIntervalDayTime intervalDayTime,
+      long totalNanos) {
+    intervalDayTime.set(totalNanos / NANOS_PER_SEC, (int) (totalNanos % NANOS_PER_SEC));
+  }
+}
+

Modified: hive/branches/spark/contrib/src/test/queries/clientnegative/serde_regex.q
URL: http://svn.apache.org/viewvc/hive/branches/spark/contrib/src/test/queries/clientnegative/serde_regex.q?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/contrib/src/test/queries/clientnegative/serde_regex.q (original)
+++ hive/branches/spark/contrib/src/test/queries/clientnegative/serde_regex.q Sat Mar 28 14:03:43 2015
@@ -7,7 +7,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,
@@ -24,7 +24,7 @@ STORED AS TEXTFILE;
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,

Modified: hive/branches/spark/contrib/src/test/queries/clientpositive/serde_regex.q
URL: http://svn.apache.org/viewvc/hive/branches/spark/contrib/src/test/queries/clientpositive/serde_regex.q?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/contrib/src/test/queries/clientpositive/serde_regex.q (original)
+++ hive/branches/spark/contrib/src/test/queries/clientpositive/serde_regex.q Sat Mar 28 14:03:43 2015
@@ -4,7 +4,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -21,7 +21,7 @@ STORED AS TEXTFILE;
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,

Modified: hive/branches/spark/contrib/src/test/results/clientnegative/serde_regex.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/contrib/src/test/results/clientnegative/serde_regex.q.out?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/contrib/src/test/results/clientnegative/serde_regex.q.out (original)
+++ hive/branches/spark/contrib/src/test/results/clientnegative/serde_regex.q.out Sat Mar 28 14:03:43 2015
@@ -9,7 +9,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,
@@ -28,7 +28,7 @@ EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,
@@ -61,7 +61,7 @@ STAGE PLANS:
 PREHOOK: query: CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status INT,

Modified: hive/branches/spark/contrib/src/test/results/clientpositive/serde_regex.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/contrib/src/test/results/clientpositive/serde_regex.q.out?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/contrib/src/test/results/clientpositive/serde_regex.q.out (original)
+++ hive/branches/spark/contrib/src/test/results/clientpositive/serde_regex.q.out Sat Mar 28 14:03:43 2015
@@ -2,7 +2,7 @@ PREHOOK: query: EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -20,7 +20,7 @@ POSTHOOK: query: EXPLAIN
 CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -53,7 +53,7 @@ STAGE PLANS:
 PREHOOK: query: CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,
@@ -72,7 +72,7 @@ PREHOOK: Output: default@serde_regex
 POSTHOOK: query: CREATE TABLE serde_regex(
   host STRING,
   identity STRING,
-  user STRING,
+  `user` STRING,
   time STRING,
   request STRING,
   status STRING,

Modified: hive/branches/spark/dev-support/jenkins-common.sh
URL: http://svn.apache.org/viewvc/hive/branches/spark/dev-support/jenkins-common.sh?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/dev-support/jenkins-common.sh (original)
+++ hive/branches/spark/dev-support/jenkins-common.sh Sat Mar 28 14:03:43 2015
@@ -91,3 +91,9 @@ process_jira() {
   fi
   export BUILD_OPTS=$build_opts
 }
+
+# Checks if a specified URL patch contains HMS upgrade changes
+# Returns 0 if there are changes; non-zero value otherwise.
+patch_contains_hms_upgrade() {
+	curl -s "$1" | grep "^diff.*metastore/scripts/upgrade/" >/dev/null
+}
\ No newline at end of file

Modified: hive/branches/spark/dev-support/jenkins-submit-build.sh
URL: http://svn.apache.org/viewvc/hive/branches/spark/dev-support/jenkins-submit-build.sh?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/dev-support/jenkins-submit-build.sh (original)
+++ hive/branches/spark/dev-support/jenkins-submit-build.sh Sat Mar 28 14:03:43 2015
@@ -27,23 +27,28 @@ case "$BUILD_PROFILE" in
   trunk-mr1|trunk-mr2)
    test -n "$TRUNK_URL" || fail "TRUNK_URL must be specified"
    url="$TRUNK_URL&ISSUE_NUM=$ISSUE_NUM"
-   curl -v -i "$url"
-   exit 0
   ;;
   spark-mr2)
    test -n "$SPARK_URL" || fail "SPARK_URL must be specified"
    url="$SPARK_URL&ISSUE_NUM=$ISSUE_NUM"
-   curl -v -i "$url"
-   exit 0
   ;;
   encryption-mr2)
    test -n "$ENCRYPTION_URL" || fail "ENCRYPTION_URL must be specified"
    url="$ENCRYPTION_URL&ISSUE_NUM=$ISSUE_NUM"
-   curl -v -i "$url"
-   exit 0
   ;;
   *)
   echo "Unknown profile '$BUILD_PROFILE'"
   exit 1
   ;;
 esac
+
+# Execute jenkins job for HMS upgrade tests if needed
+if patch_contains_hms_upgrade "${JIRA_ROOT_URL}$PATCH_URL"; then
+  test -n "$HMS_UPGRADE_URL" || fail "HMS_UPGRADE_URL must be specified"
+  echo "Calling HMS upgrade testing job..."
+  curl -v -i "${HMS_UPGRADE_URL}&ISSUE_NUM=${ISSUE_NUM}&BRANCH=${BRANCH}"
+fi
+
+# Execute jenkins job for specific profile
+echo "Calling Precommit $BRANCH Build..."
+curl -v -i "$url"

Modified: hive/branches/spark/hbase-handler/src/test/queries/positive/hbase_timestamp.q
URL: http://svn.apache.org/viewvc/hive/branches/spark/hbase-handler/src/test/queries/positive/hbase_timestamp.q?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/hbase-handler/src/test/queries/positive/hbase_timestamp.q (original)
+++ hive/branches/spark/hbase-handler/src/test/queries/positive/hbase_timestamp.q Sat Mar 28 14:03:43 2015
@@ -10,7 +10,7 @@ DROP TABLE hbase_table;
 CREATE TABLE hbase_table (key string, value string, time bigint)
   STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
   WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp");
-FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754000 WHERE (key % 17) = 0;
+FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754 WHERE (key % 17) = 0;
 SELECT key, value, cast(time as timestamp) FROM hbase_table;
 
 DROP TABLE hbase_table;
@@ -19,23 +19,23 @@ CREATE TABLE hbase_table (key string, va
   WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string,:timestamp");
 insert overwrite table hbase_table select key,value,ts FROM
 (
-  select key, value, 100000000000 as ts from src WHERE (key % 33) = 0
+  select key, value, 100000000 as ts from src WHERE (key % 33) = 0
   UNION ALL
-  select key, value, 200000000000 as ts from src WHERE (key % 37) = 0
+  select key, value, 200000000 as ts from src WHERE (key % 37) = 0
 ) T;
 
 explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000000;
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000;
 
 explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000000;
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000;
 
 explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000000;
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000;
 
 explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000000;
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000;
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000;

Modified: hive/branches/spark/hbase-handler/src/test/results/positive/hbase_timestamp.q.out
URL: http://svn.apache.org/viewvc/hive/branches/spark/hbase-handler/src/test/results/positive/hbase_timestamp.q.out?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/hbase-handler/src/test/results/positive/hbase_timestamp.q.out (original)
+++ hive/branches/spark/hbase-handler/src/test/results/positive/hbase_timestamp.q.out Sat Mar 28 14:03:43 2015
@@ -81,11 +81,11 @@ POSTHOOK: query: CREATE TABLE hbase_tabl
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@hbase_table
-PREHOOK: query: FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754000 WHERE (key % 17) = 0
+PREHOOK: query: FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754 WHERE (key % 17) = 0
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@hbase_table
-POSTHOOK: query: FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754000 WHERE (key % 17) = 0
+POSTHOOK: query: FROM src INSERT OVERWRITE TABLE hbase_table SELECT key, value, 1329959754 WHERE (key % 17) = 0
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@hbase_table
@@ -139,27 +139,27 @@ POSTHOOK: Output: database:default
 POSTHOOK: Output: default@hbase_table
 PREHOOK: query: insert overwrite table hbase_table select key,value,ts FROM
 (
-  select key, value, 100000000000 as ts from src WHERE (key % 33) = 0
+  select key, value, 100000000 as ts from src WHERE (key % 33) = 0
   UNION ALL
-  select key, value, 200000000000 as ts from src WHERE (key % 37) = 0
+  select key, value, 200000000 as ts from src WHERE (key % 37) = 0
 ) T
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@hbase_table
 POSTHOOK: query: insert overwrite table hbase_table select key,value,ts FROM
 (
-  select key, value, 100000000000 as ts from src WHERE (key % 33) = 0
+  select key, value, 100000000 as ts from src WHERE (key % 33) = 0
   UNION ALL
-  select key, value, 200000000000 as ts from src WHERE (key % 37) = 0
+  select key, value, 200000000 as ts from src WHERE (key % 37) = 0
 ) T
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@hbase_table
 PREHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000
 PREHOOK: type: QUERY
 POSTHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -171,10 +171,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: hbase_table
-            filterExpr: (((key > 100.0) and (key < 400.0)) and (time < 200000000000)) (type: boolean)
+            filterExpr: (((key > 100.0) and (key < 400.0)) and (time < 200000000)) (type: boolean)
             Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time < 200000000000))) (type: boolean)
+              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time < 200000000))) (type: boolean)
               Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string), CAST( time AS TIMESTAMP) (type: timestamp)
@@ -194,21 +194,21 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000000
+PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000
 PREHOOK: type: QUERY
 PREHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000000
+POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time < 200000000
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
 165	val_165	1973-03-03 01:46:40
 396	val_396	1973-03-03 01:46:40
 PREHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000
 PREHOOK: type: QUERY
 POSTHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -220,10 +220,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: hbase_table
-            filterExpr: (((key > 100.0) and (key < 400.0)) and (time > 100000000000)) (type: boolean)
+            filterExpr: (((key > 100.0) and (key < 400.0)) and (time > 100000000)) (type: boolean)
             Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time > 100000000000))) (type: boolean)
+              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time > 100000000))) (type: boolean)
               Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string), CAST( time AS TIMESTAMP) (type: timestamp)
@@ -243,11 +243,11 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000000
+PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000
 PREHOOK: type: QUERY
 PREHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000000
+POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time > 100000000
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
@@ -256,10 +256,10 @@ POSTHOOK: Input: default@hbase_table
 296	val_296	1976-05-03 12:33:20
 333	val_333	1976-05-03 12:33:20
 PREHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000
 PREHOOK: type: QUERY
 POSTHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -271,10 +271,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: hbase_table
-            filterExpr: (((key > 100.0) and (key < 400.0)) and (time <= 100000000000)) (type: boolean)
+            filterExpr: (((key > 100.0) and (key < 400.0)) and (time <= 100000000)) (type: boolean)
             Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time <= 100000000000))) (type: boolean)
+              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time <= 100000000))) (type: boolean)
               Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string), CAST( time AS TIMESTAMP) (type: timestamp)
@@ -294,21 +294,21 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000000
+PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000
 PREHOOK: type: QUERY
 PREHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000000
+POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time <= 100000000
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
 165	val_165	1973-03-03 01:46:40
 396	val_396	1973-03-03 01:46:40
 PREHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000
 PREHOOK: type: QUERY
 POSTHOOK: query: explain
-SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000000
+SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -320,10 +320,10 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: hbase_table
-            filterExpr: (((key > 100.0) and (key < 400.0)) and (time >= 200000000000)) (type: boolean)
+            filterExpr: (((key > 100.0) and (key < 400.0)) and (time >= 200000000)) (type: boolean)
             Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time >= 200000000000))) (type: boolean)
+              predicate: ((UDFToDouble(key) > 100.0) and ((UDFToDouble(key) < 400.0) and (time >= 200000000))) (type: boolean)
               Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string), CAST( time AS TIMESTAMP) (type: timestamp)
@@ -343,11 +343,11 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000000
+PREHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000
 PREHOOK: type: QUERY
 PREHOOK: Input: default@hbase_table
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000000
+POSTHOOK: query: SELECT key, value, cast(time as timestamp) FROM hbase_table WHERE key > 100 AND key < 400 AND time >= 200000000
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@hbase_table
 #### A masked pattern was here ####

Modified: hive/branches/spark/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java
URL: http://svn.apache.org/viewvc/hive/branches/spark/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java?rev=1669775&r1=1669774&r2=1669775&view=diff
==============================================================================
--- hive/branches/spark/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java (original)
+++ hive/branches/spark/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/security/TestStorageBasedMetastoreAuthorizationReads.java Sat Mar 28 14:03:43 2015
@@ -60,7 +60,7 @@ public class TestStorageBasedMetastoreAu
     setPermissions(db.getLocationUri(), "-rwxrwxrwx");
 
     String dbDotTable = dbName + "." + tblName;
-    resp = driver.run("create table " + dbDotTable + "(i int) partitioned by (date string)");
+    resp = driver.run("create table " + dbDotTable + "(i int) partitioned by (`date` string)");
     Assert.assertEquals(0, resp.getResponseCode());
     Table tab = msc.getTable(dbName, tblName);
     setPermissions(tab.getSd().getLocation(), perm);