Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java
 Thu Mar 26 17:49:31 2015
@@ -28,6 +28,8 @@ import org.apache.commons.lang.ArrayUtil
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.hive.common.type.HiveChar;
 import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
 import org.apache.hadoop.hive.common.type.HiveVarchar;
 import org.apache.hadoop.hive.ql.exec.vector.*;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
@@ -47,6 +49,8 @@ import org.apache.hadoop.hive.serde2.obj
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableFloatObjectInspector;
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveCharObjectInspector;
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveDecimalObjectInspector;
+import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveIntervalDayTimeObjectInspector;
+import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveIntervalYearMonthObjectInspector;
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveVarcharObjectInspector;
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableIntObjectInspector;
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableLongObjectInspector;
@@ -56,6 +60,7 @@ import org.apache.hadoop.hive.serde2.obj
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.VoidObjectInspector;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
 import org.apache.hadoop.io.Text;
+import org.apache.hive.common.util.DateUtils;
 
 /**
  * VectorExpressionWritableFactory helper class for generating 
VectorExpressionWritable objects.
@@ -430,6 +435,12 @@ public final class VectorExpressionWrite
           case DATE:
             return genVectorExpressionWritableDate(
                 (SettableDateObjectInspector) fieldObjInspector);
+          case INTERVAL_YEAR_MONTH:
+            return genVectorExpressionWritableIntervalYearMonth(
+                (SettableHiveIntervalYearMonthObjectInspector) 
fieldObjInspector);
+          case INTERVAL_DAY_TIME:
+            return genVectorExpressionWritableIntervalDayTime(
+                (SettableHiveIntervalDayTimeObjectInspector) 
fieldObjInspector);
           case DECIMAL:
             return genVectorExpressionWritableDecimal(
                 (SettableHiveDecimalObjectInspector) fieldObjInspector);
@@ -586,6 +597,84 @@ public final class VectorExpressionWrite
       }
    }.init(fieldObjInspector);
   }
+
+  private static VectorExpressionWriter 
genVectorExpressionWritableIntervalYearMonth(
+      SettableHiveIntervalYearMonthObjectInspector fieldObjInspector) throws 
HiveException {
+    return new VectorExpressionWriterLong() {
+      private Object obj;
+      private HiveIntervalYearMonth interval;
+
+      public VectorExpressionWriter 
init(SettableHiveIntervalYearMonthObjectInspector objInspector)
+          throws HiveException {
+        super.init(objInspector);
+        interval = new HiveIntervalYearMonth();
+        obj = initValue(null);
+        return this;
+      }
+
+      @Override
+      public Object writeValue(long value) {
+        interval.set((int) value);
+        ((SettableHiveIntervalYearMonthObjectInspector) 
this.objectInspector).set(obj, interval);
+        return obj;
+      }
+
+      @Override
+      public Object setValue(Object field, long value) {
+        if (null == field) {
+          field = initValue(null);
+        }
+        interval.set((int) value);
+        ((SettableHiveIntervalYearMonthObjectInspector) 
this.objectInspector).set(field, interval);
+        return field;
+      }
+
+      @Override
+      public Object initValue(Object ignored) {
+        return ((SettableHiveIntervalYearMonthObjectInspector) 
this.objectInspector)
+            .create(new HiveIntervalYearMonth());
+      }
+   }.init(fieldObjInspector);
+  }
+
+  private static VectorExpressionWriter 
genVectorExpressionWritableIntervalDayTime(
+      SettableHiveIntervalDayTimeObjectInspector fieldObjInspector) throws 
HiveException {
+    return new VectorExpressionWriterLong() {
+      private Object obj;
+      private HiveIntervalDayTime interval;
+
+      public VectorExpressionWriter 
init(SettableHiveIntervalDayTimeObjectInspector objInspector)
+          throws HiveException {
+        super.init(objInspector);
+        interval = new HiveIntervalDayTime();
+        obj = initValue(null);
+        return this;
+      }
+
+      @Override
+      public Object writeValue(long value) {
+        DateUtils.setIntervalDayTimeTotalNanos(interval, value);
+        ((SettableHiveIntervalDayTimeObjectInspector) 
this.objectInspector).set(obj, interval);
+        return obj;
+      }
+
+      @Override
+      public Object setValue(Object field, long value) {
+        if (null == field) {
+          field = initValue(null);
+        }
+        DateUtils.setIntervalDayTimeTotalNanos(interval, value);
+        ((SettableHiveIntervalDayTimeObjectInspector) 
this.objectInspector).set(field, interval);
+        return field;
+      }
+
+      @Override
+      public Object initValue(Object ignored) {
+        return ((SettableHiveIntervalDayTimeObjectInspector) 
this.objectInspector)
+            .create(new HiveIntervalDayTime());
+      }
+   }.init(fieldObjInspector);
+  }
 
   private static VectorExpressionWriter genVectorExpressionWritableChar(
         SettableHiveCharObjectInspector fieldObjInspector) throws 
HiveException {

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java
 Thu Mar 26 17:49:31 2015
@@ -34,7 +34,6 @@ import org.apache.hadoop.hive.ql.parse.A
 import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
 import org.apache.hadoop.hive.ql.parse.HiveParser;
 import org.apache.hadoop.hive.ql.parse.ParseDriver;
-import org.apache.hive.common.util.DateTimeMath;
 
 class ASTBuilder {
 

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
 Thu Mar 26 17:49:31 2015
@@ -118,6 +118,7 @@ import org.apache.hadoop.hive.ql.udf.UDF
 import org.apache.hadoop.hive.ql.udf.UDFWeekOfYear;
 import org.apache.hadoop.hive.ql.udf.UDFYear;
 import org.apache.hadoop.hive.ql.udf.generic.*;
+import org.apache.hadoop.hive.serde.serdeConstants;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.StructField;
 import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
@@ -148,6 +149,8 @@ public class Vectorizer implements Physi
     patternBuilder.append("|long");
     patternBuilder.append("|short");
     patternBuilder.append("|timestamp");
+    patternBuilder.append("|" + serdeConstants.INTERVAL_YEAR_MONTH_TYPE_NAME);
+    patternBuilder.append("|" + serdeConstants.INTERVAL_DAY_TIME_TYPE_NAME);
     patternBuilder.append("|boolean");
     patternBuilder.append("|binary");
     patternBuilder.append("|string");
@@ -261,6 +264,8 @@ public class Vectorizer implements Physi
     supportedGenericUDFs.add(GenericUDFToDate.class);
     supportedGenericUDFs.add(GenericUDFToChar.class);
     supportedGenericUDFs.add(GenericUDFToVarchar.class);
+    supportedGenericUDFs.add(GenericUDFToIntervalYearMonth.class);
+    supportedGenericUDFs.add(GenericUDFToIntervalDayTime.class);
 
     // For conditional expressions
     supportedGenericUDFs.add(GenericUDFIf.class);

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIMinus.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIMinus.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIMinus.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIMinus.java
 Thu Mar 26 17:49:31 2015
@@ -30,6 +30,7 @@ import org.apache.hadoop.hive.ql.exec.No
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.util.DateTimeMath;
 import org.apache.hadoop.hive.serde2.io.DateWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
@@ -44,7 +45,6 @@ import org.apache.hadoop.hive.serde2.obj
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
-import org.apache.hive.common.util.DateTimeMath;
 
 @Description(name = "-", value = "a _FUNC_ b - Returns the difference a-b")
 public class GenericUDFOPDTIMinus extends GenericUDFBaseDTI {

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIPlus.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIPlus.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIPlus.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIPlus.java
 Thu Mar 26 17:49:31 2015
@@ -30,6 +30,7 @@ import org.apache.hadoop.hive.ql.exec.No
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.util.DateTimeMath;
 import org.apache.hadoop.hive.serde2.io.DateWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
@@ -44,7 +45,6 @@ import org.apache.hadoop.hive.serde2.obj
 import 
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
-import org.apache.hive.common.util.DateTimeMath;
 
 @Description(name = "+", value = "a _FUNC_ b - Returns a+b")
 public class GenericUDFOPDTIPlus extends GenericUDFBaseDTI {

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqual.java
 Thu Mar 26 17:49:31 2015
@@ -55,7 +55,13 @@ import org.apache.hadoop.hive.serde2.obj
   TimestampColEqualLongScalar.class, LongScalarEqualTimestampColumn.class,
   FilterTimestampColEqualLongScalar.class, 
FilterLongScalarEqualTimestampColumn.class,
   TimestampColEqualDoubleScalar.class, DoubleScalarEqualTimestampColumn.class,
-  FilterTimestampColEqualDoubleScalar.class, 
FilterDoubleScalarEqualTimestampColumn.class
+  FilterTimestampColEqualDoubleScalar.class, 
FilterDoubleScalarEqualTimestampColumn.class,
+  IntervalYearMonthScalarEqualIntervalYearMonthColumn.class, 
FilterIntervalYearMonthScalarEqualIntervalYearMonthColumn.class,
+  IntervalYearMonthColEqualIntervalYearMonthScalar.class, 
FilterIntervalYearMonthColEqualIntervalYearMonthScalar.class,
+  IntervalDayTimeScalarEqualIntervalDayTimeColumn.class, 
FilterIntervalDayTimeScalarEqualIntervalDayTimeColumn.class,
+  IntervalDayTimeColEqualIntervalDayTimeScalar.class, 
FilterIntervalDayTimeColEqualIntervalDayTimeScalar.class,
+  DateColEqualDateScalar.class,FilterDateColEqualDateScalar.class,
+  DateScalarEqualDateColumn.class,FilterDateScalarEqualDateColumn.class,
   })
 public class GenericUDFOPEqual extends GenericUDFBaseCompare {
   public GenericUDFOPEqual(){

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrGreaterThan.java
 Thu Mar 26 17:49:31 2015
@@ -56,7 +56,13 @@ import org.apache.hadoop.io.Text;
   TimestampColGreaterEqualLongScalar.class, 
LongScalarGreaterEqualTimestampColumn.class,
   FilterTimestampColGreaterEqualLongScalar.class, 
FilterLongScalarGreaterEqualTimestampColumn.class,
   TimestampColGreaterEqualDoubleScalar.class, 
DoubleScalarGreaterEqualTimestampColumn.class,
-  FilterTimestampColGreaterEqualDoubleScalar.class, 
FilterDoubleScalarGreaterEqualTimestampColumn.class
+  FilterTimestampColGreaterEqualDoubleScalar.class, 
FilterDoubleScalarGreaterEqualTimestampColumn.class,
+  IntervalYearMonthScalarGreaterEqualIntervalYearMonthColumn.class, 
FilterIntervalYearMonthScalarGreaterEqualIntervalYearMonthColumn.class,
+  IntervalYearMonthColGreaterEqualIntervalYearMonthScalar.class, 
FilterIntervalYearMonthColGreaterEqualIntervalYearMonthScalar.class,
+  IntervalDayTimeScalarGreaterEqualIntervalDayTimeColumn.class, 
FilterIntervalDayTimeScalarGreaterEqualIntervalDayTimeColumn.class,
+  IntervalDayTimeColGreaterEqualIntervalDayTimeScalar.class, 
FilterIntervalDayTimeColGreaterEqualIntervalDayTimeScalar.class,
+  
DateColGreaterEqualDateScalar.class,FilterDateColGreaterEqualDateScalar.class,
+  
DateScalarGreaterEqualDateColumn.class,FilterDateScalarGreaterEqualDateColumn.class,
   })
 public class GenericUDFOPEqualOrGreaterThan extends GenericUDFBaseCompare {
   public GenericUDFOPEqualOrGreaterThan(){

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPEqualOrLessThan.java
 Thu Mar 26 17:49:31 2015
@@ -56,7 +56,13 @@ import org.apache.hadoop.io.Text;
   TimestampColLessEqualLongScalar.class, 
LongScalarLessEqualTimestampColumn.class,
   FilterTimestampColLessEqualLongScalar.class, 
FilterLongScalarLessEqualTimestampColumn.class,
   TimestampColLessEqualDoubleScalar.class, 
DoubleScalarLessEqualTimestampColumn.class,
-  FilterTimestampColLessEqualDoubleScalar.class, 
FilterDoubleScalarLessEqualTimestampColumn.class
+  FilterTimestampColLessEqualDoubleScalar.class, 
FilterDoubleScalarLessEqualTimestampColumn.class,
+  IntervalYearMonthScalarLessEqualIntervalYearMonthColumn.class, 
FilterIntervalYearMonthScalarLessEqualIntervalYearMonthColumn.class,
+  IntervalYearMonthColLessEqualIntervalYearMonthScalar.class, 
FilterIntervalYearMonthColLessEqualIntervalYearMonthScalar.class,
+  IntervalDayTimeScalarLessEqualIntervalDayTimeColumn.class, 
FilterIntervalDayTimeScalarLessEqualIntervalDayTimeColumn.class,
+  IntervalDayTimeColLessEqualIntervalDayTimeScalar.class, 
FilterIntervalDayTimeColLessEqualIntervalDayTimeScalar.class,
+  DateColLessEqualDateScalar.class,FilterDateColLessEqualDateScalar.class,
+  
DateScalarLessEqualDateColumn.class,FilterDateScalarLessEqualDateColumn.class,
   })
 public class GenericUDFOPEqualOrLessThan extends GenericUDFBaseCompare {
   public GenericUDFOPEqualOrLessThan(){

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPGreaterThan.java
 Thu Mar 26 17:49:31 2015
@@ -56,7 +56,13 @@ import org.apache.hadoop.io.Text;
   TimestampColGreaterLongScalar.class, LongScalarGreaterTimestampColumn.class,
   FilterTimestampColGreaterLongScalar.class, 
FilterLongScalarGreaterTimestampColumn.class,
   TimestampColGreaterDoubleScalar.class, 
DoubleScalarGreaterTimestampColumn.class,
-  FilterTimestampColGreaterDoubleScalar.class, 
FilterDoubleScalarGreaterTimestampColumn.class
+  FilterTimestampColGreaterDoubleScalar.class, 
FilterDoubleScalarGreaterTimestampColumn.class,
+  IntervalYearMonthScalarGreaterIntervalYearMonthColumn.class, 
FilterIntervalYearMonthScalarGreaterIntervalYearMonthColumn.class,
+  IntervalYearMonthColGreaterIntervalYearMonthScalar.class, 
FilterIntervalYearMonthColGreaterIntervalYearMonthScalar.class,
+  IntervalDayTimeScalarGreaterIntervalDayTimeColumn.class, 
FilterIntervalDayTimeScalarGreaterIntervalDayTimeColumn.class,
+  IntervalDayTimeColGreaterIntervalDayTimeScalar.class, 
FilterIntervalDayTimeColGreaterIntervalDayTimeScalar.class,
+  DateColGreaterDateScalar.class,FilterDateColGreaterDateScalar.class,
+  DateScalarGreaterDateColumn.class,FilterDateScalarGreaterDateColumn.class,
   })
 public class GenericUDFOPGreaterThan extends GenericUDFBaseCompare {
   public GenericUDFOPGreaterThan(){

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPLessThan.java
 Thu Mar 26 17:49:31 2015
@@ -56,7 +56,13 @@ import org.apache.hadoop.io.Text;
     TimestampColLessLongScalar.class, LongScalarLessTimestampColumn.class,
     FilterTimestampColLessLongScalar.class, 
FilterLongScalarLessTimestampColumn.class,
     TimestampColLessDoubleScalar.class, DoubleScalarLessTimestampColumn.class,
-    FilterTimestampColLessDoubleScalar.class, 
FilterDoubleScalarLessTimestampColumn.class
+    FilterTimestampColLessDoubleScalar.class, 
FilterDoubleScalarLessTimestampColumn.class,
+    IntervalYearMonthScalarLessIntervalYearMonthColumn.class, 
FilterIntervalYearMonthScalarLessIntervalYearMonthColumn.class,
+    IntervalYearMonthColLessIntervalYearMonthScalar.class, 
FilterIntervalYearMonthColLessIntervalYearMonthScalar.class,
+    IntervalDayTimeScalarLessIntervalDayTimeColumn.class, 
FilterIntervalDayTimeScalarLessIntervalDayTimeColumn.class,
+    IntervalDayTimeColLessIntervalDayTimeScalar.class, 
FilterIntervalDayTimeColLessIntervalDayTimeScalar.class,
+    DateColLessDateScalar.class,FilterDateColLessDateScalar.class,
+    DateScalarLessDateColumn.class,FilterDateScalarLessDateColumn.class,
     })
 public class GenericUDFOPLessThan extends GenericUDFBaseCompare {
   public GenericUDFOPLessThan(){

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMinus.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMinus.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMinus.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMinus.java
 Thu Mar 26 17:49:31 2015
@@ -31,7 +31,38 @@ import org.apache.hadoop.hive.ql.exec.ve
   LongScalarSubtractLongColumn.class, LongScalarSubtractDoubleColumn.class,
   DoubleScalarSubtractLongColumn.class, DoubleScalarSubtractDoubleColumn.class,
   DecimalColSubtractDecimalColumn.class, DecimalColSubtractDecimalScalar.class,
-  DecimalScalarSubtractDecimalColumn.class})
+  DecimalScalarSubtractDecimalColumn.class,
+  IntervalYearMonthColSubtractIntervalYearMonthColumn.class,
+  IntervalYearMonthColSubtractIntervalYearMonthScalar.class,
+  IntervalYearMonthScalarSubtractIntervalYearMonthColumn.class,
+  IntervalDayTimeColSubtractIntervalDayTimeColumn.class,
+  IntervalDayTimeColSubtractIntervalDayTimeScalar.class,
+  IntervalDayTimeScalarSubtractIntervalDayTimeColumn.class,
+  TimestampColSubtractIntervalDayTimeColumn.class,
+  TimestampColSubtractIntervalDayTimeScalar.class,
+  TimestampScalarSubtractIntervalDayTimeColumn.class,
+  TimestampColSubtractTimestampColumn.class,
+  TimestampColSubtractTimestampScalar.class,
+  TimestampScalarSubtractTimestampColumn.class,
+  DateColSubtractDateColumn.class,
+  DateColSubtractDateScalar.class,
+  DateScalarSubtractDateColumn.class,
+  DateColSubtractTimestampColumn.class,
+  DateColSubtractTimestampScalar.class,
+  DateScalarSubtractTimestampColumn.class,
+  TimestampColSubtractDateColumn.class,
+  TimestampColSubtractDateScalar.class,
+  TimestampScalarSubtractDateColumn.class,
+  DateColSubtractIntervalDayTimeColumn.class,
+  DateColSubtractIntervalDayTimeScalar.class,
+  DateScalarSubtractIntervalDayTimeColumn.class,
+  DateColSubtractIntervalYearMonthColumn.class,
+  DateScalarSubtractIntervalYearMonthColumn.class,
+  DateColSubtractIntervalYearMonthScalar.class,
+  TimestampColSubtractIntervalYearMonthColumn.class,
+  TimestampScalarSubtractIntervalYearMonthColumn.class,
+  TimestampColSubtractIntervalYearMonthScalar.class,
+})
 public class GenericUDFOPMinus extends GenericUDFBaseArithmetic {
 
   public GenericUDFOPMinus() {

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNotEqual.java
 Thu Mar 26 17:49:31 2015
@@ -55,7 +55,13 @@ import org.apache.hadoop.hive.serde2.obj
   TimestampColNotEqualLongScalar.class, 
LongScalarNotEqualTimestampColumn.class,
   FilterTimestampColNotEqualLongScalar.class, 
FilterLongScalarNotEqualTimestampColumn.class,
   TimestampColNotEqualDoubleScalar.class, 
DoubleScalarNotEqualTimestampColumn.class,
-  FilterTimestampColNotEqualDoubleScalar.class, 
FilterDoubleScalarNotEqualTimestampColumn.class
+  FilterTimestampColNotEqualDoubleScalar.class, 
FilterDoubleScalarNotEqualTimestampColumn.class,
+  IntervalYearMonthScalarNotEqualIntervalYearMonthColumn.class, 
FilterIntervalYearMonthScalarNotEqualIntervalYearMonthColumn.class,
+  IntervalYearMonthColNotEqualIntervalYearMonthScalar.class, 
FilterIntervalYearMonthColNotEqualIntervalYearMonthScalar.class,
+  IntervalDayTimeScalarNotEqualIntervalDayTimeColumn.class, 
FilterIntervalDayTimeScalarNotEqualIntervalDayTimeColumn.class,
+  IntervalDayTimeColNotEqualIntervalDayTimeScalar.class, 
FilterIntervalDayTimeColNotEqualIntervalDayTimeScalar.class,
+  DateColNotEqualDateScalar.class,FilterDateColNotEqualDateScalar.class,
+  DateScalarNotEqualDateColumn.class,FilterDateScalarNotEqualDateColumn.class,
   })
 public class GenericUDFOPNotEqual extends GenericUDFBaseCompare {
   public GenericUDFOPNotEqual(){

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPPlus.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPPlus.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPPlus.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPPlus.java
 Thu Mar 26 17:49:31 2015
@@ -37,7 +37,38 @@ import org.apache.hadoop.hive.ql.exec.ve
   LongColAddDoubleScalar.class, DoubleColAddLongScalar.class, 
DoubleColAddDoubleScalar.class,
   LongScalarAddLongColumn.class, LongScalarAddDoubleColumn.class, 
DoubleScalarAddLongColumn.class,
   DoubleScalarAddDoubleColumn.class, DecimalScalarAddDecimalColumn.class, 
DecimalColAddDecimalColumn.class,
-  DecimalColAddDecimalScalar.class})
+  DecimalColAddDecimalScalar.class,
+  IntervalYearMonthColAddIntervalYearMonthColumn.class,
+  IntervalYearMonthColAddIntervalYearMonthScalar.class,
+  IntervalYearMonthScalarAddIntervalYearMonthColumn.class,
+  IntervalDayTimeColAddIntervalDayTimeColumn.class,
+  IntervalDayTimeColAddIntervalDayTimeScalar.class,
+  IntervalDayTimeScalarAddIntervalDayTimeColumn.class,
+  IntervalDayTimeColAddTimestampColumn.class,
+  IntervalDayTimeColAddTimestampScalar.class,
+  IntervalDayTimeScalarAddTimestampColumn.class,
+  TimestampColAddIntervalDayTimeColumn.class,
+  TimestampColAddIntervalDayTimeScalar.class,
+  TimestampScalarAddIntervalDayTimeColumn.class,
+  DateColAddIntervalDayTimeColumn.class,
+  DateColAddIntervalDayTimeScalar.class,
+  DateScalarAddIntervalDayTimeColumn.class,
+  IntervalDayTimeColAddDateColumn.class,
+  IntervalDayTimeColAddDateScalar.class,
+  IntervalDayTimeScalarAddDateColumn.class,
+  IntervalYearMonthColAddDateColumn.class,
+  IntervalYearMonthColAddDateScalar.class,
+  IntervalYearMonthScalarAddDateColumn.class,
+  IntervalYearMonthColAddTimestampColumn.class,
+  IntervalYearMonthColAddTimestampScalar.class,
+  IntervalYearMonthScalarAddTimestampColumn.class,
+  DateColAddIntervalYearMonthColumn.class,
+  DateScalarAddIntervalYearMonthColumn.class,
+  DateColAddIntervalYearMonthScalar.class,
+  TimestampColAddIntervalYearMonthColumn.class,
+  TimestampScalarAddIntervalYearMonthColumn.class,
+  TimestampColAddIntervalYearMonthScalar.class
+})
 public class GenericUDFOPPlus extends GenericUDFBaseArithmetic {
 
   public GenericUDFOPPlus() {

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalDayTime.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalDayTime.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalDayTime.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalDayTime.java
 Thu Mar 26 17:49:31 2015
@@ -21,6 +21,8 @@ package org.apache.hadoop.hive.ql.udf.ge
 import org.apache.hadoop.hive.ql.exec.Description;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
+import 
org.apache.hadoop.hive.ql.exec.vector.expressions.CastStringToIntervalDayTime;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
@@ -39,6 +41,7 @@ import org.apache.hadoop.hive.serde2.obj
 */
 @Description(name = "interval_day_time",
   value = "CAST(<string> AS INTERVAL DAY TO SECOND) - Returns the day-time 
interval represented by the string")
+@VectorizedExpressions({CastStringToIntervalDayTime.class})
 public class GenericUDFToIntervalDayTime extends GenericUDF {
 
   private transient PrimitiveObjectInspector argumentOI;

Modified: 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalYearMonth.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalYearMonth.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalYearMonth.java
 (original)
+++ 
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalYearMonth.java
 Thu Mar 26 17:49:31 2015
@@ -21,6 +21,8 @@ package org.apache.hadoop.hive.ql.udf.ge
 import org.apache.hadoop.hive.ql.exec.Description;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
 import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
+import 
org.apache.hadoop.hive.ql.exec.vector.expressions.CastStringToIntervalYearMonth;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
@@ -39,6 +41,7 @@ import org.apache.hadoop.hive.serde2.obj
 */
 @Description(name = "interval_year_month",
   value = "CAST(<string> AS INTERVAL YEAR TO MONTH) - Returns the year-month 
interval represented by the string")
+@VectorizedExpressions({CastStringToIntervalYearMonth.class})
 public class GenericUDFToIntervalYearMonth extends GenericUDF {
 
   private transient PrimitiveObjectInspector argumentOI;

Copied: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/util/DateTimeMath.java 
(from r1669375, 
hive/trunk/common/src/java/org/apache/hive/common/util/DateTimeMath.java)
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/util/DateTimeMath.java?p2=hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/util/DateTimeMath.java&p1=hive/trunk/common/src/java/org/apache/hive/common/util/DateTimeMath.java&r1=1669375&r2=1669376&rev=1669376&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hive/common/util/DateTimeMath.java 
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/util/DateTimeMath.java Thu 
Mar 26 17:49:31 2015
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.hive.common.util;
+package org.apache.hadoop.hive.ql.util;
 
 import java.sql.Date;
 import java.sql.Timestamp;
@@ -25,6 +25,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
 import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hive.common.util.DateUtils;
 
 
 public class DateTimeMath {
@@ -78,6 +80,23 @@ public class DateTimeMath {
     return calLocal.getTimeInMillis();
   }
 
+  public long addMonthsToNanosUtc(long nanos, int months) {
+    long result = addMonthsToMillisUtc(nanos / 1000000, months) * 1000000 + 
(nanos % 1000000);
+    return result;
+  }
+
+  public long addMonthsToNanosLocal(long nanos, int months) {
+    long result = addMonthsToMillisLocal(nanos / 1000000, months) * 1000000 + 
(nanos % 1000000);
+    return result;
+  }
+
+  public long addMonthsToDays(long days, int months) {
+    long millis = DateWritable.daysToMillis((int) days);
+    millis = addMonthsToMillisLocal(millis, months);
+    // Convert millis result back to days
+    return DateWritable.millisToDays(millis);
+  }
+
   public Timestamp add(Timestamp ts, HiveIntervalYearMonth interval) {
     if (ts == null || interval == null) {
       return null;

Modified: 
hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizationContext.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizationContext.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- 
hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizationContext.java
 (original)
+++ 
hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizationContext.java
 Thu Mar 26 17:49:31 2015
@@ -151,7 +151,7 @@ public class TestVectorizationContext {
     VectorUDFUnixTimeStampLong v1 = new VectorUDFUnixTimeStampLong();
     VectorExpressionDescriptor.Builder builder1 = new 
VectorExpressionDescriptor.Builder();
     VectorExpressionDescriptor.Descriptor d1 = 
builder1.setMode(VectorExpressionDescriptor.Mode.PROJECTION)
-        
.setNumArguments(1).setArgumentTypes(VectorExpressionDescriptor.ArgumentType.INT_DATETIME_FAMILY)
+        
.setNumArguments(1).setArgumentTypes(VectorExpressionDescriptor.ArgumentType.INT_DATETIME_INTERVAL_FAMILY)
         
.setInputExpressionTypes(VectorExpressionDescriptor.InputExpressionType.COLUMN).build();
     assertTrue(d1.matches(v1.getDescriptor()));
 

Copied: 
hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java 
(from r1669375, 
hive/trunk/common/src/test/org/apache/hive/common/util/TestDateTimeMath.java)
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java?p2=hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java&p1=hive/trunk/common/src/test/org/apache/hive/common/util/TestDateTimeMath.java&r1=1669375&r2=1669376&rev=1669376&view=diff
==============================================================================
--- 
hive/trunk/common/src/test/org/apache/hive/common/util/TestDateTimeMath.java 
(original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java 
Thu Mar 26 17:49:31 2015
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.hive.common.util;
+package org.apache.hadoop.hive.ql.util;
 
 import java.sql.Date;
 import java.sql.Timestamp;
@@ -23,6 +23,7 @@ import java.util.TimeZone;
 
 import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
 import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.ql.util.DateTimeMath;
 import org.junit.*;
 
 import static org.junit.Assert.*;

Added: hive/trunk/ql/src/test/queries/clientpositive/vector_date_1.q
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/vector_date_1.q?rev=1669376&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/vector_date_1.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/vector_date_1.q Thu Mar 26 
17:49:31 2015
@@ -0,0 +1,184 @@
+
+set hive.vectorized.execution.enabled=true;
+set hive.fetch.task.conversion=minimal;
+
+drop table if exists vector_date_1;
+create table vector_date_1 (dt1 date, dt2 date) stored as orc;
+
+insert into table vector_date_1
+  select null, null from src limit 1;
+insert into table vector_date_1
+  select date '1999-12-31', date '2000-01-01' from src limit 1;
+insert into table vector_date_1
+  select date '2001-01-01', date '2001-06-01' from src limit 1;
+
+-- column-to-column comparison in select clause
+explain
+select
+  dt1, dt2,
+  -- should be all true
+  dt1 = dt1,
+  dt1 != dt2,
+  dt1 <= dt1,
+  dt1 <= dt2,
+  dt1 < dt2,
+  dt2 >= dt2,
+  dt2 >= dt1,
+  dt2 > dt1
+from vector_date_1 order by dt1;
+
+select
+  dt1, dt2,
+  -- should be all true
+  dt1 = dt1,
+  dt1 != dt2,
+  dt1 <= dt1,
+  dt1 <= dt2,
+  dt1 < dt2,
+  dt2 >= dt2,
+  dt2 >= dt1,
+  dt2 > dt1
+from vector_date_1 order by dt1;
+
+explain
+select
+  dt1, dt2,
+  -- should be all false
+  dt1 != dt1,
+  dt1 = dt2,
+  dt1 < dt1,
+  dt1 >= dt2,
+  dt1 > dt2,
+  dt2 > dt2,
+  dt2 <= dt1,
+  dt2 < dt1
+from vector_date_1 order by dt1;
+
+select
+  dt1, dt2,
+  -- should be all false
+  dt1 != dt1,
+  dt1 = dt2,
+  dt1 < dt1,
+  dt1 >= dt2,
+  dt1 > dt2,
+  dt2 > dt2,
+  dt2 <= dt1,
+  dt2 < dt1
+from vector_date_1 order by dt1;
+
+-- column-to-literal/literal-to-column comparison in select clause
+explain
+select
+  dt1,
+  -- should be all true
+  dt1 != date '1970-01-01',
+  dt1 >= date '1970-01-01',
+  dt1 > date '1970-01-01',
+  dt1 <= date '2100-01-01',
+  dt1 < date '2100-01-01',
+  date '1970-01-01' != dt1,
+  date '1970-01-01' <= dt1,
+  date '1970-01-01' < dt1
+from vector_date_1 order by dt1;
+
+select
+  dt1,
+  -- should be all true
+  dt1 != date '1970-01-01',
+  dt1 >= date '1970-01-01',
+  dt1 > date '1970-01-01',
+  dt1 <= date '2100-01-01',
+  dt1 < date '2100-01-01',
+  date '1970-01-01' != dt1,
+  date '1970-01-01' <= dt1,
+  date '1970-01-01' < dt1
+from vector_date_1 order by dt1;
+
+explain
+select
+  dt1,
+  -- should all be false
+  dt1 = date '1970-01-01',
+  dt1 <= date '1970-01-01',
+  dt1 < date '1970-01-01',
+  dt1 >= date '2100-01-01',
+  dt1 > date '2100-01-01',
+  date '1970-01-01' = dt1,
+  date '1970-01-01' >= dt1,
+  date '1970-01-01' > dt1
+from vector_date_1 order by dt1;
+
+select
+  dt1,
+  -- should all be false
+  dt1 = date '1970-01-01',
+  dt1 <= date '1970-01-01',
+  dt1 < date '1970-01-01',
+  dt1 >= date '2100-01-01',
+  dt1 > date '2100-01-01',
+  date '1970-01-01' = dt1,
+  date '1970-01-01' >= dt1,
+  date '1970-01-01' > dt1
+from vector_date_1 order by dt1;
+
+
+-- column-to-column comparisons in predicate
+-- all rows with non-null dt1 should be returned
+explain
+select
+  dt1, dt2
+from vector_date_1
+where
+  dt1 = dt1
+  and dt1 != dt2
+  and dt1 < dt2
+  and dt1 <= dt2
+  and dt2 > dt1
+  and dt2 >= dt1
+order by dt1;
+
+select
+  dt1, dt2
+from vector_date_1
+where
+  dt1 = dt1
+  and dt1 != dt2
+  and dt1 < dt2
+  and dt1 <= dt2
+  and dt2 > dt1
+  and dt2 >= dt1
+order by dt1;
+
+-- column-to-literal/literal-to-column comparison in predicate
+-- only a single row should be returned
+explain
+select
+  dt1, dt2
+from vector_date_1
+where
+  dt1 = date '2001-01-01'
+  and date '2001-01-01' = dt1
+  and dt1 != date '1970-01-01'
+  and date '1970-01-01' != dt1
+  and dt1 > date '1970-01-01'
+  and dt1 >= date '1970-01-01'
+  and date '1970-01-01' < dt1
+  and date '1970-01-01' <= dt1
+order by dt1;
+
+select
+  dt1, dt2
+from vector_date_1
+where
+  dt1 = date '2001-01-01'
+  and date '2001-01-01' = dt1
+  and dt1 != date '1970-01-01'
+  and date '1970-01-01' != dt1
+  and dt1 > date '1970-01-01'
+  and dt1 >= date '1970-01-01'
+  and date '1970-01-01' < dt1
+  and date '1970-01-01' <= dt1
+order by dt1;
+
+drop table vector_date_1;

Added: hive/trunk/ql/src/test/queries/clientpositive/vector_interval_1.q
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/vector_interval_1.q?rev=1669376&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/vector_interval_1.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/vector_interval_1.q Thu Mar 
26 17:49:31 2015
@@ -0,0 +1,196 @@
+
+set hive.vectorized.execution.enabled=true;
+set hive.fetch.task.conversion=minimal;
+
+drop table if exists vector_interval_1;
+create table vector_interval_1 (ts timestamp, dt date, str1 string, str2 
string) stored as orc;
+
+insert into vector_interval_1
+  select timestamp '2001-01-01 01:02:03', date '2001-01-01', '1-2', '1 2:3:4' 
from src limit 1;
+insert into vector_interval_1
+  select null, null, null, null from src limit 1;
+
+-- constants/cast from string
+explain
+select
+  str1,
+  interval '1-2' year to month, interval_year_month(str1),
+  interval '1 2:3:4' day to second, interval_day_time(str2)
+from vector_interval_1 order by str1;
+
+select
+  str1,
+  interval '1-2' year to month, interval_year_month(str1),
+  interval '1 2:3:4' day to second, interval_day_time(str2)
+from vector_interval_1 order by str1;
+
+
+-- interval arithmetic
+explain
+select
+  dt,
+  interval '1-2' year to month + interval '1-2' year to month,
+  interval_year_month(str1) + interval_year_month(str1),
+  interval '1-2' year to month + interval_year_month(str1),
+  interval '1-2' year to month - interval '1-2' year to month,
+  interval_year_month(str1) - interval_year_month(str1),
+  interval '1-2' year to month - interval_year_month(str1)
+from vector_interval_1 order by dt;
+
+select
+  dt,
+  interval '1-2' year to month + interval '1-2' year to month,
+  interval_year_month(str1) + interval_year_month(str1),
+  interval '1-2' year to month + interval_year_month(str1),
+  interval '1-2' year to month - interval '1-2' year to month,
+  interval_year_month(str1) - interval_year_month(str1),
+  interval '1-2' year to month - interval_year_month(str1)
+from vector_interval_1 order by dt;
+
+explain
+select
+  dt,
+  interval '1 2:3:4' day to second + interval '1 2:3:4' day to second,
+  interval_day_time(str2) + interval_day_time(str2),
+  interval '1 2:3:4' day to second + interval_day_time(str2),
+  interval '1 2:3:4' day to second - interval '1 2:3:4' day to second,
+  interval_day_time(str2) - interval_day_time(str2),
+  interval '1 2:3:4' day to second - interval_day_time(str2)
+from vector_interval_1 order by dt;
+
+select
+  dt,
+  interval '1 2:3:4' day to second + interval '1 2:3:4' day to second,
+  interval_day_time(str2) + interval_day_time(str2),
+  interval '1 2:3:4' day to second + interval_day_time(str2),
+  interval '1 2:3:4' day to second - interval '1 2:3:4' day to second,
+  interval_day_time(str2) - interval_day_time(str2),
+  interval '1 2:3:4' day to second - interval_day_time(str2)
+from vector_interval_1 order by dt;
+
+
+-- date-interval arithmetic
+explain
+select
+  dt,
+  dt + interval '1-2' year to month,
+  dt + interval_year_month(str1),
+  interval '1-2' year to month + dt,
+  interval_year_month(str1) + dt,
+  dt - interval '1-2' year to month,
+  dt - interval_year_month(str1),
+  dt + interval '1 2:3:4' day to second,
+  dt + interval_day_time(str2),
+  interval '1 2:3:4' day to second + dt,
+  interval_day_time(str2) + dt,
+  dt - interval '1 2:3:4' day to second,
+  dt - interval_day_time(str2)
+from vector_interval_1 order by dt;
+
+select
+  dt,
+  dt + interval '1-2' year to month,
+  dt + interval_year_month(str1),
+  interval '1-2' year to month + dt,
+  interval_year_month(str1) + dt,
+  dt - interval '1-2' year to month,
+  dt - interval_year_month(str1),
+  dt + interval '1 2:3:4' day to second,
+  dt + interval_day_time(str2),
+  interval '1 2:3:4' day to second + dt,
+  interval_day_time(str2) + dt,
+  dt - interval '1 2:3:4' day to second,
+  dt - interval_day_time(str2)
+from vector_interval_1 order by dt;
+
+
+-- timestamp-interval arithmetic
+explain
+select
+  ts,
+  ts + interval '1-2' year to month,
+  ts + interval_year_month(str1),
+  interval '1-2' year to month + ts,
+  interval_year_month(str1) + ts,
+  ts - interval '1-2' year to month,
+  ts - interval_year_month(str1),
+  ts + interval '1 2:3:4' day to second,
+  ts + interval_day_time(str2),
+  interval '1 2:3:4' day to second + ts,
+  interval_day_time(str2) + ts,
+  ts - interval '1 2:3:4' day to second,
+  ts - interval_day_time(str2)
+from vector_interval_1 order by ts;
+
+select
+  ts,
+  ts + interval '1-2' year to month,
+  ts + interval_year_month(str1),
+  interval '1-2' year to month + ts,
+  interval_year_month(str1) + ts,
+  ts - interval '1-2' year to month,
+  ts - interval_year_month(str1),
+  ts + interval '1 2:3:4' day to second,
+  ts + interval_day_time(str2),
+  interval '1 2:3:4' day to second + ts,
+  interval_day_time(str2) + ts,
+  ts - interval '1 2:3:4' day to second,
+  ts - interval_day_time(str2)
+from vector_interval_1 order by ts;
+
+
+-- timestamp-timestamp arithmetic
+explain
+select
+  ts,
+  ts - ts,
+  timestamp '2001-01-01 01:02:03' - ts,
+  ts - timestamp '2001-01-01 01:02:03'
+from vector_interval_1 order by ts;
+
+select
+  ts,
+  ts - ts,
+  timestamp '2001-01-01 01:02:03' - ts,
+  ts - timestamp '2001-01-01 01:02:03'
+from vector_interval_1 order by ts;
+
+
+-- date-date arithmetic
+explain
+select
+  dt,
+  dt - dt,
+  date '2001-01-01' - dt,
+  dt - date '2001-01-01'
+from vector_interval_1 order by dt;
+
+select
+  dt,
+  dt - dt,
+  date '2001-01-01' - dt,
+  dt - date '2001-01-01'
+from vector_interval_1 order by dt;
+
+
+-- date-timestamp arithmetic
+explain
+select
+  dt,
+  ts - dt,
+  timestamp '2001-01-01 01:02:03' - dt,
+  ts - date '2001-01-01',
+  dt - ts,
+  dt - timestamp '2001-01-01 01:02:03',
+  date '2001-01-01' - ts
+from vector_interval_1 order by dt;
+
+select
+  dt,
+  ts - dt,
+  timestamp '2001-01-01 01:02:03' - dt,
+  ts - date '2001-01-01',
+  dt - ts,
+  dt - timestamp '2001-01-01 01:02:03',
+  date '2001-01-01' - ts
+from vector_interval_1 order by dt;

Added: hive/trunk/ql/src/test/queries/clientpositive/vector_interval_2.q
URL: 
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/vector_interval_2.q?rev=1669376&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/vector_interval_2.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/vector_interval_2.q Thu Mar 
26 17:49:31 2015
@@ -0,0 +1,530 @@
+set hive.vectorized.execution.enabled=true;
+set hive.fetch.task.conversion=minimal;
+
+drop table if exists vector_interval_2;
+create table vector_interval_2 (ts timestamp, dt date, str1 string, str2 
string, str3 string, str4 string) stored as orc;
+
+insert into vector_interval_2
+  select timestamp '2001-01-01 01:02:03', date '2001-01-01', '1-2', '1-3', '1 
2:3:4', '1 2:3:5' from src limit 1;
+insert into vector_interval_2
+  select null, null, null, null, null, null from src limit 1;
+
+
+-- interval comparisons in select clause
+
+explain
+select
+  str1,
+  -- Should all be true
+  interval_year_month(str1) = interval_year_month(str1),
+  interval_year_month(str1) <= interval_year_month(str1),
+  interval_year_month(str1) <= interval_year_month(str2),
+  interval_year_month(str1) < interval_year_month(str2),
+  interval_year_month(str1) >= interval_year_month(str1),
+  interval_year_month(str2) >= interval_year_month(str1),
+  interval_year_month(str2) > interval_year_month(str1),
+  interval_year_month(str1) != interval_year_month(str2),
+
+  interval_year_month(str1) = interval '1-2' year to month,
+  interval_year_month(str1) <= interval '1-2' year to month,
+  interval_year_month(str1) <= interval '1-3' year to month,
+  interval_year_month(str1) < interval '1-3' year to month,
+  interval_year_month(str1) >= interval '1-2' year to month,
+  interval_year_month(str2) >= interval '1-2' year to month,
+  interval_year_month(str2) > interval '1-2' year to month,
+  interval_year_month(str1) != interval '1-3' year to month,
+
+  interval '1-2' year to month = interval_year_month(str1),
+  interval '1-2' year to month <= interval_year_month(str1),
+  interval '1-2' year to month <= interval_year_month(str2),
+  interval '1-2' year to month < interval_year_month(str2),
+  interval '1-2' year to month >= interval_year_month(str1),
+  interval '1-3' year to month >= interval_year_month(str1),
+  interval '1-3' year to month > interval_year_month(str1),
+  interval '1-2' year to month != interval_year_month(str2)
+from vector_interval_2 order by str1;
+
+select
+  str1,
+  -- Should all be true
+  interval_year_month(str1) = interval_year_month(str1),
+  interval_year_month(str1) <= interval_year_month(str1),
+  interval_year_month(str1) <= interval_year_month(str2),
+  interval_year_month(str1) < interval_year_month(str2),
+  interval_year_month(str1) >= interval_year_month(str1),
+  interval_year_month(str2) >= interval_year_month(str1),
+  interval_year_month(str2) > interval_year_month(str1),
+  interval_year_month(str1) != interval_year_month(str2),
+
+  interval_year_month(str1) = interval '1-2' year to month,
+  interval_year_month(str1) <= interval '1-2' year to month,
+  interval_year_month(str1) <= interval '1-3' year to month,
+  interval_year_month(str1) < interval '1-3' year to month,
+  interval_year_month(str1) >= interval '1-2' year to month,
+  interval_year_month(str2) >= interval '1-2' year to month,
+  interval_year_month(str2) > interval '1-2' year to month,
+  interval_year_month(str1) != interval '1-3' year to month,
+
+  interval '1-2' year to month = interval_year_month(str1),
+  interval '1-2' year to month <= interval_year_month(str1),
+  interval '1-2' year to month <= interval_year_month(str2),
+  interval '1-2' year to month < interval_year_month(str2),
+  interval '1-2' year to month >= interval_year_month(str1),
+  interval '1-3' year to month >= interval_year_month(str1),
+  interval '1-3' year to month > interval_year_month(str1),
+  interval '1-2' year to month != interval_year_month(str2)
+from vector_interval_2 order by str1;
+
+explain
+select
+  str1,
+  -- Should all be false
+  interval_year_month(str1) != interval_year_month(str1),
+  interval_year_month(str1) >= interval_year_month(str2),
+  interval_year_month(str1) > interval_year_month(str2),
+  interval_year_month(str2) <= interval_year_month(str1),
+  interval_year_month(str2) < interval_year_month(str1),
+  interval_year_month(str1) != interval_year_month(str1),
+
+  interval_year_month(str1) != interval '1-2' year to month,
+  interval_year_month(str1) >= interval '1-3' year to month,
+  interval_year_month(str1) > interval '1-3' year to month,
+  interval_year_month(str2) <= interval '1-2' year to month,
+  interval_year_month(str2) < interval '1-2' year to month,
+  interval_year_month(str1) != interval '1-2' year to month,
+
+  interval '1-2' year to month != interval_year_month(str1),
+  interval '1-2' year to month >= interval_year_month(str2),
+  interval '1-2' year to month > interval_year_month(str2),
+  interval '1-3' year to month <= interval_year_month(str1),
+  interval '1-3' year to month < interval_year_month(str1),
+  interval '1-2' year to month != interval_year_month(str1)
+from vector_interval_2 order by str1;
+
+select
+  str1,
+  -- Should all be false
+  interval_year_month(str1) != interval_year_month(str1),
+  interval_year_month(str1) >= interval_year_month(str2),
+  interval_year_month(str1) > interval_year_month(str2),
+  interval_year_month(str2) <= interval_year_month(str1),
+  interval_year_month(str2) < interval_year_month(str1),
+  interval_year_month(str1) != interval_year_month(str1),
+
+  interval_year_month(str1) != interval '1-2' year to month,
+  interval_year_month(str1) >= interval '1-3' year to month,
+  interval_year_month(str1) > interval '1-3' year to month,
+  interval_year_month(str2) <= interval '1-2' year to month,
+  interval_year_month(str2) < interval '1-2' year to month,
+  interval_year_month(str1) != interval '1-2' year to month,
+
+  interval '1-2' year to month != interval_year_month(str1),
+  interval '1-2' year to month >= interval_year_month(str2),
+  interval '1-2' year to month > interval_year_month(str2),
+  interval '1-3' year to month <= interval_year_month(str1),
+  interval '1-3' year to month < interval_year_month(str1),
+  interval '1-2' year to month != interval_year_month(str1)
+from vector_interval_2 order by str1;
+
+explain
+select
+  str3,
+  -- Should all be true
+  interval_day_time(str3) = interval_day_time(str3),
+  interval_day_time(str3) <= interval_day_time(str3),
+  interval_day_time(str3) <= interval_day_time(str4),
+  interval_day_time(str3) < interval_day_time(str4),
+  interval_day_time(str3) >= interval_day_time(str3),
+  interval_day_time(str4) >= interval_day_time(str3),
+  interval_day_time(str4) > interval_day_time(str3),
+  interval_day_time(str3) != interval_day_time(str4),
+
+  interval_day_time(str3) = interval '1 2:3:4' day to second,
+  interval_day_time(str3) <= interval '1 2:3:4' day to second,
+  interval_day_time(str3) <= interval '1 2:3:5' day to second,
+  interval_day_time(str3) < interval '1 2:3:5' day to second,
+  interval_day_time(str3) >= interval '1 2:3:4' day to second,
+  interval_day_time(str4) >= interval '1 2:3:4' day to second,
+  interval_day_time(str4) > interval '1 2:3:4' day to second,
+  interval_day_time(str3) != interval '1 2:3:5' day to second,
+
+  interval '1 2:3:4' day to second = interval_day_time(str3),
+  interval '1 2:3:4' day to second <= interval_day_time(str3),
+  interval '1 2:3:4' day to second <= interval_day_time(str4),
+  interval '1 2:3:4' day to second < interval_day_time(str4),
+  interval '1 2:3:4' day to second >= interval_day_time(str3),
+  interval '1 2:3:5' day to second >= interval_day_time(str3),
+  interval '1 2:3:5' day to second > interval_day_time(str3),
+  interval '1 2:3:4' day to second != interval_day_time(str4)
+from vector_interval_2 order by str3;
+
+select
+  str3,
+  -- Should all be true
+  interval_day_time(str3) = interval_day_time(str3),
+  interval_day_time(str3) <= interval_day_time(str3),
+  interval_day_time(str3) <= interval_day_time(str4),
+  interval_day_time(str3) < interval_day_time(str4),
+  interval_day_time(str3) >= interval_day_time(str3),
+  interval_day_time(str4) >= interval_day_time(str3),
+  interval_day_time(str4) > interval_day_time(str3),
+  interval_day_time(str3) != interval_day_time(str4),
+
+  interval_day_time(str3) = interval '1 2:3:4' day to second,
+  interval_day_time(str3) <= interval '1 2:3:4' day to second,
+  interval_day_time(str3) <= interval '1 2:3:5' day to second,
+  interval_day_time(str3) < interval '1 2:3:5' day to second,
+  interval_day_time(str3) >= interval '1 2:3:4' day to second,
+  interval_day_time(str4) >= interval '1 2:3:4' day to second,
+  interval_day_time(str4) > interval '1 2:3:4' day to second,
+  interval_day_time(str3) != interval '1 2:3:5' day to second,
+
+  interval '1 2:3:4' day to second = interval_day_time(str3),
+  interval '1 2:3:4' day to second <= interval_day_time(str3),
+  interval '1 2:3:4' day to second <= interval_day_time(str4),
+  interval '1 2:3:4' day to second < interval_day_time(str4),
+  interval '1 2:3:4' day to second >= interval_day_time(str3),
+  interval '1 2:3:5' day to second >= interval_day_time(str3),
+  interval '1 2:3:5' day to second > interval_day_time(str3),
+  interval '1 2:3:4' day to second != interval_day_time(str4)
+from vector_interval_2 order by str3;
+
+explain
+select
+  str3,
+  -- Should all be false
+  interval_day_time(str3) != interval_day_time(str3),
+  interval_day_time(str3) >= interval_day_time(str4),
+  interval_day_time(str3) > interval_day_time(str4),
+  interval_day_time(str4) <= interval_day_time(str3),
+  interval_day_time(str4) < interval_day_time(str3),
+  interval_day_time(str3) != interval_day_time(str3),
+
+  interval_day_time(str3) != interval '1 2:3:4' day to second,
+  interval_day_time(str3) >= interval '1 2:3:5' day to second,
+  interval_day_time(str3) > interval '1 2:3:5' day to second,
+  interval_day_time(str4) <= interval '1 2:3:4' day to second,
+  interval_day_time(str4) < interval '1 2:3:4' day to second,
+  interval_day_time(str3) != interval '1 2:3:4' day to second,
+
+  interval '1 2:3:4' day to second != interval_day_time(str3),
+  interval '1 2:3:4' day to second >= interval_day_time(str4),
+  interval '1 2:3:4' day to second > interval_day_time(str4),
+  interval '1 2:3:5' day to second <= interval_day_time(str3),
+  interval '1 2:3:5' day to second < interval_day_time(str3),
+  interval '1 2:3:4' day to second != interval_day_time(str3)
+from vector_interval_2 order by str3;
+
+select
+  str3,
+  -- Should all be false
+  interval_day_time(str3) != interval_day_time(str3),
+  interval_day_time(str3) >= interval_day_time(str4),
+  interval_day_time(str3) > interval_day_time(str4),
+  interval_day_time(str4) <= interval_day_time(str3),
+  interval_day_time(str4) < interval_day_time(str3),
+  interval_day_time(str3) != interval_day_time(str3),
+
+  interval_day_time(str3) != interval '1 2:3:4' day to second,
+  interval_day_time(str3) >= interval '1 2:3:5' day to second,
+  interval_day_time(str3) > interval '1 2:3:5' day to second,
+  interval_day_time(str4) <= interval '1 2:3:4' day to second,
+  interval_day_time(str4) < interval '1 2:3:4' day to second,
+  interval_day_time(str3) != interval '1 2:3:4' day to second,
+
+  interval '1 2:3:4' day to second != interval_day_time(str3),
+  interval '1 2:3:4' day to second >= interval_day_time(str4),
+  interval '1 2:3:4' day to second > interval_day_time(str4),
+  interval '1 2:3:5' day to second <= interval_day_time(str3),
+  interval '1 2:3:5' day to second < interval_day_time(str3),
+  interval '1 2:3:4' day to second != interval_day_time(str3)
+from vector_interval_2 order by str3;
+
+
+-- interval expressions in predicates
+explain
+select ts from vector_interval_2
+where
+  interval_year_month(str1) = interval_year_month(str1)
+  and interval_year_month(str1) != interval_year_month(str2)
+  and interval_year_month(str1) <= interval_year_month(str2)
+  and interval_year_month(str1) < interval_year_month(str2)
+  and interval_year_month(str2) >= interval_year_month(str1)
+  and interval_year_month(str2) > interval_year_month(str1)
+
+  and interval_year_month(str1) = interval '1-2' year to month
+  and interval_year_month(str1) != interval '1-3' year to month
+  and interval_year_month(str1) <= interval '1-3' year to month
+  and interval_year_month(str1) < interval '1-3' year to month
+  and interval_year_month(str2) >= interval '1-2' year to month
+  and interval_year_month(str2) > interval '1-2' year to month
+
+  and interval '1-2' year to month = interval_year_month(str1)
+  and interval '1-2' year to month != interval_year_month(str2)
+  and interval '1-2' year to month <= interval_year_month(str2)
+  and interval '1-2' year to month < interval_year_month(str2)
+  and interval '1-3' year to month >= interval_year_month(str1)
+  and interval '1-3' year to month > interval_year_month(str1)
+order by ts;
+
+select ts from vector_interval_2
+where
+  interval_year_month(str1) = interval_year_month(str1)
+  and interval_year_month(str1) != interval_year_month(str2)
+  and interval_year_month(str1) <= interval_year_month(str2)
+  and interval_year_month(str1) < interval_year_month(str2)
+  and interval_year_month(str2) >= interval_year_month(str1)
+  and interval_year_month(str2) > interval_year_month(str1)
+
+  and interval_year_month(str1) = interval '1-2' year to month
+  and interval_year_month(str1) != interval '1-3' year to month
+  and interval_year_month(str1) <= interval '1-3' year to month
+  and interval_year_month(str1) < interval '1-3' year to month
+  and interval_year_month(str2) >= interval '1-2' year to month
+  and interval_year_month(str2) > interval '1-2' year to month
+
+  and interval '1-2' year to month = interval_year_month(str1)
+  and interval '1-2' year to month != interval_year_month(str2)
+  and interval '1-2' year to month <= interval_year_month(str2)
+  and interval '1-2' year to month < interval_year_month(str2)
+  and interval '1-3' year to month >= interval_year_month(str1)
+  and interval '1-3' year to month > interval_year_month(str1)
+order by ts;
+
+explain
+select ts from vector_interval_2
+where
+  interval_day_time(str3) = interval_day_time(str3)
+  and interval_day_time(str3) != interval_day_time(str4)
+  and interval_day_time(str3) <= interval_day_time(str4)
+  and interval_day_time(str3) < interval_day_time(str4)
+  and interval_day_time(str4) >= interval_day_time(str3)
+  and interval_day_time(str4) > interval_day_time(str3)
+
+  and interval_day_time(str3) = interval '1 2:3:4' day to second
+  and interval_day_time(str3) != interval '1 2:3:5' day to second
+  and interval_day_time(str3) <= interval '1 2:3:5' day to second
+  and interval_day_time(str3) < interval '1 2:3:5' day to second
+  and interval_day_time(str4) >= interval '1 2:3:4' day to second
+  and interval_day_time(str4) > interval '1 2:3:4' day to second
+
+  and interval '1 2:3:4' day to second = interval_day_time(str3)
+  and interval '1 2:3:4' day to second != interval_day_time(str4)
+  and interval '1 2:3:4' day to second <= interval_day_time(str4)
+  and interval '1 2:3:4' day to second < interval_day_time(str4)
+  and interval '1 2:3:5' day to second >= interval_day_time(str3)
+  and interval '1 2:3:5' day to second > interval_day_time(str3)
+order by ts;
+
+select ts from vector_interval_2
+where
+  interval_day_time(str3) = interval_day_time(str3)
+  and interval_day_time(str3) != interval_day_time(str4)
+  and interval_day_time(str3) <= interval_day_time(str4)
+  and interval_day_time(str3) < interval_day_time(str4)
+  and interval_day_time(str4) >= interval_day_time(str3)
+  and interval_day_time(str4) > interval_day_time(str3)
+
+  and interval_day_time(str3) = interval '1 2:3:4' day to second
+  and interval_day_time(str3) != interval '1 2:3:5' day to second
+  and interval_day_time(str3) <= interval '1 2:3:5' day to second
+  and interval_day_time(str3) < interval '1 2:3:5' day to second
+  and interval_day_time(str4) >= interval '1 2:3:4' day to second
+  and interval_day_time(str4) > interval '1 2:3:4' day to second
+
+  and interval '1 2:3:4' day to second = interval_day_time(str3)
+  and interval '1 2:3:4' day to second != interval_day_time(str4)
+  and interval '1 2:3:4' day to second <= interval_day_time(str4)
+  and interval '1 2:3:4' day to second < interval_day_time(str4)
+  and interval '1 2:3:5' day to second >= interval_day_time(str3)
+  and interval '1 2:3:5' day to second > interval_day_time(str3)
+order by ts;
+
+explain
+select ts from vector_interval_2
+where
+  date '2002-03-01' = dt + interval_year_month(str1)
+  and date '2002-03-01' <= dt + interval_year_month(str1)
+  and date '2002-03-01' >= dt + interval_year_month(str1)
+  and dt + interval_year_month(str1) = date '2002-03-01'
+  and dt + interval_year_month(str1) <= date '2002-03-01'
+  and dt + interval_year_month(str1) >= date '2002-03-01'
+  and dt != dt + interval_year_month(str1)
+
+  and date '2002-03-01' = dt + interval '1-2' year to month
+  and date '2002-03-01' <= dt + interval '1-2' year to month
+  and date '2002-03-01' >= dt + interval '1-2' year to month
+  and dt + interval '1-2' year to month = date '2002-03-01'
+  and dt + interval '1-2' year to month <= date '2002-03-01'
+  and dt + interval '1-2' year to month >= date '2002-03-01'
+  and dt != dt + interval '1-2' year to month
+order by ts;
+
+select ts from vector_interval_2
+where
+  date '2002-03-01' = dt + interval_year_month(str1)
+  and date '2002-03-01' <= dt + interval_year_month(str1)
+  and date '2002-03-01' >= dt + interval_year_month(str1)
+  and dt + interval_year_month(str1) = date '2002-03-01'
+  and dt + interval_year_month(str1) <= date '2002-03-01'
+  and dt + interval_year_month(str1) >= date '2002-03-01'
+  and dt != dt + interval_year_month(str1)
+
+  and date '2002-03-01' = dt + interval '1-2' year to month
+  and date '2002-03-01' <= dt + interval '1-2' year to month
+  and date '2002-03-01' >= dt + interval '1-2' year to month
+  and dt + interval '1-2' year to month = date '2002-03-01'
+  and dt + interval '1-2' year to month <= date '2002-03-01'
+  and dt + interval '1-2' year to month >= date '2002-03-01'
+  and dt != dt + interval '1-2' year to month
+order by ts;
+
+explain
+select ts from vector_interval_2
+where
+  timestamp '2002-03-01 01:02:03' = ts + interval '1-2' year to month
+  and timestamp '2002-03-01 01:02:03' <= ts + interval '1-2' year to month
+  and timestamp '2002-03-01 01:02:03' >= ts + interval '1-2' year to month
+  and timestamp '2002-04-01 01:02:03' != ts + interval '1-2' year to month
+  and timestamp '2002-02-01 01:02:03' < ts + interval '1-2' year to month
+  and timestamp '2002-04-01 01:02:03' > ts + interval '1-2' year to month
+
+  and ts + interval '1-2' year to month = timestamp '2002-03-01 01:02:03'
+  and ts + interval '1-2' year to month >= timestamp '2002-03-01 01:02:03'
+  and ts + interval '1-2' year to month <= timestamp '2002-03-01 01:02:03'
+  and ts + interval '1-2' year to month != timestamp '2002-04-01 01:02:03'
+  and ts + interval '1-2' year to month > timestamp '2002-02-01 01:02:03'
+  and ts + interval '1-2' year to month < timestamp '2002-04-01 01:02:03'
+
+  and ts = ts + interval '0' year
+  and ts != ts + interval '1' year
+  and ts <= ts + interval '1' year
+  and ts < ts + interval '1' year
+  and ts >= ts - interval '1' year
+  and ts > ts - interval '1' year
+order by ts;
+
+select ts from vector_interval_2
+where
+  timestamp '2002-03-01 01:02:03' = ts + interval '1-2' year to month
+  and timestamp '2002-03-01 01:02:03' <= ts + interval '1-2' year to month
+  and timestamp '2002-03-01 01:02:03' >= ts + interval '1-2' year to month
+  and timestamp '2002-04-01 01:02:03' != ts + interval '1-2' year to month
+  and timestamp '2002-02-01 01:02:03' < ts + interval '1-2' year to month
+  and timestamp '2002-04-01 01:02:03' > ts + interval '1-2' year to month
+
+  and ts + interval '1-2' year to month = timestamp '2002-03-01 01:02:03'
+  and ts + interval '1-2' year to month >= timestamp '2002-03-01 01:02:03'
+  and ts + interval '1-2' year to month <= timestamp '2002-03-01 01:02:03'
+  and ts + interval '1-2' year to month != timestamp '2002-04-01 01:02:03'
+  and ts + interval '1-2' year to month > timestamp '2002-02-01 01:02:03'
+  and ts + interval '1-2' year to month < timestamp '2002-04-01 01:02:03'
+
+  and ts = ts + interval '0' year
+  and ts != ts + interval '1' year
+  and ts <= ts + interval '1' year
+  and ts < ts + interval '1' year
+  and ts >= ts - interval '1' year
+  and ts > ts - interval '1' year
+order by ts;
+
+-- day to second expressions in predicate
+explain
+select ts from vector_interval_2
+where
+  timestamp '2001-01-01 01:02:03' = dt + interval '0 1:2:3' day to second
+  and timestamp '2001-01-01 01:02:03' != dt + interval '0 1:2:4' day to second
+  and timestamp '2001-01-01 01:02:03' <= dt + interval '0 1:2:3' day to second
+  and timestamp '2001-01-01 01:02:03' < dt + interval '0 1:2:4' day to second
+  and timestamp '2001-01-01 01:02:03' >= dt - interval '0 1:2:3' day to second
+  and timestamp '2001-01-01 01:02:03' > dt - interval '0 1:2:4' day to second
+
+  and dt + interval '0 1:2:3' day to second = timestamp '2001-01-01 01:02:03'
+  and dt + interval '0 1:2:4' day to second != timestamp '2001-01-01 01:02:03'
+  and dt + interval '0 1:2:3' day to second >= timestamp '2001-01-01 01:02:03'
+  and dt + interval '0 1:2:4' day to second > timestamp '2001-01-01 01:02:03'
+  and dt - interval '0 1:2:3' day to second <= timestamp '2001-01-01 01:02:03'
+  and dt - interval '0 1:2:4' day to second < timestamp '2001-01-01 01:02:03'
+
+  and ts = dt + interval '0 1:2:3' day to second
+  and ts != dt + interval '0 1:2:4' day to second
+  and ts <= dt + interval '0 1:2:3' day to second
+  and ts < dt + interval '0 1:2:4' day to second
+  and ts >= dt - interval '0 1:2:3' day to second
+  and ts > dt - interval '0 1:2:4' day to second
+order by ts;
+
+select ts from vector_interval_2
+where
+  timestamp '2001-01-01 01:02:03' = dt + interval '0 1:2:3' day to second
+  and timestamp '2001-01-01 01:02:03' != dt + interval '0 1:2:4' day to second
+  and timestamp '2001-01-01 01:02:03' <= dt + interval '0 1:2:3' day to second
+  and timestamp '2001-01-01 01:02:03' < dt + interval '0 1:2:4' day to second
+  and timestamp '2001-01-01 01:02:03' >= dt - interval '0 1:2:3' day to second
+  and timestamp '2001-01-01 01:02:03' > dt - interval '0 1:2:4' day to second
+
+  and dt + interval '0 1:2:3' day to second = timestamp '2001-01-01 01:02:03'
+  and dt + interval '0 1:2:4' day to second != timestamp '2001-01-01 01:02:03'
+  and dt + interval '0 1:2:3' day to second >= timestamp '2001-01-01 01:02:03'
+  and dt + interval '0 1:2:4' day to second > timestamp '2001-01-01 01:02:03'
+  and dt - interval '0 1:2:3' day to second <= timestamp '2001-01-01 01:02:03'
+  and dt - interval '0 1:2:4' day to second < timestamp '2001-01-01 01:02:03'
+
+  and ts = dt + interval '0 1:2:3' day to second
+  and ts != dt + interval '0 1:2:4' day to second
+  and ts <= dt + interval '0 1:2:3' day to second
+  and ts < dt + interval '0 1:2:4' day to second
+  and ts >= dt - interval '0 1:2:3' day to second
+  and ts > dt - interval '0 1:2:4' day to second
+order by ts;
+
+explain
+select ts from vector_interval_2
+where
+  timestamp '2001-01-01 01:02:03' = ts + interval '0' day
+  and timestamp '2001-01-01 01:02:03' != ts + interval '1' day
+  and timestamp '2001-01-01 01:02:03' <= ts + interval '1' day
+  and timestamp '2001-01-01 01:02:03' < ts + interval '1' day
+  and timestamp '2001-01-01 01:02:03' >= ts - interval '1' day
+  and timestamp '2001-01-01 01:02:03' > ts - interval '1' day
+
+  and ts + interval '0' day = timestamp '2001-01-01 01:02:03'
+  and ts + interval '1' day != timestamp '2001-01-01 01:02:03'
+  and ts + interval '1' day >= timestamp '2001-01-01 01:02:03'
+  and ts + interval '1' day > timestamp '2001-01-01 01:02:03'
+  and ts - interval '1' day <= timestamp '2001-01-01 01:02:03'
+  and ts - interval '1' day < timestamp '2001-01-01 01:02:03'
+
+  and ts = ts + interval '0' day
+  and ts != ts + interval '1' day
+  and ts <= ts + interval '1' day
+  and ts < ts + interval '1' day
+  and ts >= ts - interval '1' day
+  and ts > ts - interval '1' day
+order by ts;
+
+select ts from vector_interval_2
+where
+  timestamp '2001-01-01 01:02:03' = ts + interval '0' day
+  and timestamp '2001-01-01 01:02:03' != ts + interval '1' day
+  and timestamp '2001-01-01 01:02:03' <= ts + interval '1' day
+  and timestamp '2001-01-01 01:02:03' < ts + interval '1' day
+  and timestamp '2001-01-01 01:02:03' >= ts - interval '1' day
+  and timestamp '2001-01-01 01:02:03' > ts - interval '1' day
+
+  and ts + interval '0' day = timestamp '2001-01-01 01:02:03'
+  and ts + interval '1' day != timestamp '2001-01-01 01:02:03'
+  and ts + interval '1' day >= timestamp '2001-01-01 01:02:03'
+  and ts + interval '1' day > timestamp '2001-01-01 01:02:03'
+  and ts - interval '1' day <= timestamp '2001-01-01 01:02:03'
+  and ts - interval '1' day < timestamp '2001-01-01 01:02:03'
+
+  and ts = ts + interval '0' day
+  and ts != ts + interval '1' day
+  and ts <= ts + interval '1' day
+  and ts < ts + interval '1' day
+  and ts >= ts - interval '1' day
+  and ts > ts - interval '1' day
+order by ts;
+
+drop table vector_interval_2;


Reply via email to