You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/06/28 22:48:34 UTC

[38/52] [abbrv] hive git commit: HIVE-20007: Hive should carry out timestamp computations in UTC (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
index 5350a00..2169999 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java
@@ -18,26 +18,25 @@
 
 package org.apache.hadoop.hive.ql.udf.generic;
 
-import java.sql.Date;
-import java.sql.Timestamp;
-
+import org.apache.hadoop.hive.common.type.Date;
 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.Timestamp;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
 import org.apache.hadoop.hive.serde2.io.ByteWritable;
-import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DateWritableV2;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
 import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
 import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
 import org.apache.hadoop.hive.serde2.io.ShortWritable;
-import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampWritableV2;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
@@ -289,8 +288,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     HiveIntervalYearMonthWritable left =
         new HiveIntervalYearMonthWritable(HiveIntervalYearMonth.valueOf("2-8"));
-    DateWritable right =
-        new DateWritable(Date.valueOf("2001-06-15"));
+    DateWritableV2 right =
+        new DateWritableV2(Date.valueOf("2001-06-15"));
     ObjectInspector[] inputOIs = {
         PrimitiveObjectInspectorFactory.writableHiveIntervalYearMonthObjectInspector,
         PrimitiveObjectInspectorFactory.writableDateObjectInspector
@@ -302,7 +301,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.dateTypeInfo, oi.getTypeInfo());
-    DateWritable res = (DateWritable) udf.evaluate(args);
+    DateWritableV2 res = (DateWritableV2) udf.evaluate(args);
     Assert.assertEquals(Date.valueOf("2004-02-15"), res.get());
   }
 
@@ -310,8 +309,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
   public void testDatePlusIntervalYearMonth() throws Exception {
     GenericUDFOPPlus udf = new GenericUDFOPPlus();
 
-    DateWritable left =
-        new DateWritable(Date.valueOf("2001-06-15"));
+    DateWritableV2 left =
+        new DateWritableV2(Date.valueOf("2001-06-15"));
     HiveIntervalYearMonthWritable right =
         new HiveIntervalYearMonthWritable(HiveIntervalYearMonth.valueOf("2-8"));
     ObjectInspector[] inputOIs = {
@@ -325,7 +324,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.dateTypeInfo, oi.getTypeInfo());
-    DateWritable res = (DateWritable) udf.evaluate(args);
+    DateWritableV2 res = (DateWritableV2) udf.evaluate(args);
     Assert.assertEquals(Date.valueOf("2004-02-15"), res.get());
   }
 
@@ -335,8 +334,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     HiveIntervalYearMonthWritable left =
         new HiveIntervalYearMonthWritable(HiveIntervalYearMonth.valueOf("2-2"));
-    TimestampWritable right =
-        new TimestampWritable(Timestamp.valueOf("2001-11-15 01:02:03.123456789"));
+    TimestampWritableV2 right =
+        new TimestampWritableV2(Timestamp.valueOf("2001-11-15 01:02:03.123456789"));
     ObjectInspector[] inputOIs = {
         PrimitiveObjectInspectorFactory.writableHiveIntervalYearMonthObjectInspector,
         PrimitiveObjectInspectorFactory.writableTimestampObjectInspector
@@ -348,7 +347,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.timestampTypeInfo, oi.getTypeInfo());
-    TimestampWritable res = (TimestampWritable) udf.evaluate(args);
+    TimestampWritableV2 res = (TimestampWritableV2) udf.evaluate(args);
     Assert.assertEquals(Timestamp.valueOf("2004-01-15 01:02:03.123456789"), res.getTimestamp());
   }
 
@@ -356,8 +355,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
   public void testTimestampPlusIntervalYearMonth() throws Exception {
     GenericUDFOPPlus udf = new GenericUDFOPPlus();
 
-    TimestampWritable left =
-        new TimestampWritable(Timestamp.valueOf("2001-11-15 01:02:03.123456789"));
+    TimestampWritableV2 left =
+        new TimestampWritableV2(Timestamp.valueOf("2001-11-15 01:02:03.123456789"));
     HiveIntervalYearMonthWritable right =
         new HiveIntervalYearMonthWritable(HiveIntervalYearMonth.valueOf("2-2"));
     ObjectInspector[] inputOIs = {
@@ -371,7 +370,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.timestampTypeInfo, oi.getTypeInfo());
-    TimestampWritable res = (TimestampWritable) udf.evaluate(args);
+    TimestampWritableV2 res = (TimestampWritableV2) udf.evaluate(args);
     Assert.assertEquals(Timestamp.valueOf("2004-01-15 01:02:03.123456789"), res.getTimestamp());
   }
 
@@ -404,8 +403,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     HiveIntervalDayTimeWritable left =
         new HiveIntervalDayTimeWritable(HiveIntervalDayTime.valueOf("1 2:3:4.567"));
-    TimestampWritable right =
-        new TimestampWritable(Timestamp.valueOf("2001-01-01 00:00:00"));
+    TimestampWritableV2 right =
+        new TimestampWritableV2(Timestamp.valueOf("2001-01-01 00:00:00"));
     ObjectInspector[] inputOIs = {
         PrimitiveObjectInspectorFactory.writableHiveIntervalDayTimeObjectInspector,
         PrimitiveObjectInspectorFactory.writableTimestampObjectInspector
@@ -417,7 +416,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.timestampTypeInfo, oi.getTypeInfo());
-    TimestampWritable res = (TimestampWritable) udf.evaluate(args);
+    TimestampWritableV2 res = (TimestampWritableV2) udf.evaluate(args);
     Assert.assertEquals(Timestamp.valueOf("2001-01-02 2:3:4.567"), res.getTimestamp());
   }
 
@@ -425,8 +424,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
   public void testTimestampPlusIntervalDayTime() throws Exception {
     GenericUDFOPPlus udf = new GenericUDFOPPlus();
 
-    TimestampWritable left =
-        new TimestampWritable(Timestamp.valueOf("2001-01-01 00:00:00"));
+    TimestampWritableV2 left =
+        new TimestampWritableV2(Timestamp.valueOf("2001-01-01 00:00:00"));
     HiveIntervalDayTimeWritable right =
         new HiveIntervalDayTimeWritable(HiveIntervalDayTime.valueOf("1 2:3:4.567"));
     ObjectInspector[] inputOIs = {
@@ -440,7 +439,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.timestampTypeInfo, oi.getTypeInfo());
-    TimestampWritable res = (TimestampWritable) udf.evaluate(args);
+    TimestampWritableV2 res = (TimestampWritableV2) udf.evaluate(args);
     Assert.assertEquals(Timestamp.valueOf("2001-01-02 2:3:4.567"), res.getTimestamp());
   }
 
@@ -450,8 +449,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
 
     HiveIntervalDayTimeWritable left =
         new HiveIntervalDayTimeWritable(HiveIntervalDayTime.valueOf("1 2:3:4.567"));
-    DateWritable right =
-        new DateWritable(Date.valueOf("2001-01-01"));
+    DateWritableV2 right =
+        new DateWritableV2(Date.valueOf("2001-01-01"));
     ObjectInspector[] inputOIs = {
         PrimitiveObjectInspectorFactory.writableHiveIntervalDayTimeObjectInspector,
         PrimitiveObjectInspectorFactory.writableDateObjectInspector
@@ -464,7 +463,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
     // Date + day-time interval = timestamp
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.timestampTypeInfo, oi.getTypeInfo());
-    TimestampWritable res = (TimestampWritable) udf.evaluate(args);
+    TimestampWritableV2 res = (TimestampWritableV2) udf.evaluate(args);
     Assert.assertEquals(Timestamp.valueOf("2001-01-02 2:3:4.567"), res.getTimestamp());
   }
 
@@ -472,8 +471,8 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
   public void testDatePlusIntervalDayTime() throws Exception {
     GenericUDFOPPlus udf = new GenericUDFOPPlus();
 
-    DateWritable left =
-        new DateWritable(Date.valueOf("2001-01-01"));
+    DateWritableV2 left =
+        new DateWritableV2(Date.valueOf("2001-01-01"));
     HiveIntervalDayTimeWritable right =
         new HiveIntervalDayTimeWritable(HiveIntervalDayTime.valueOf("1 2:3:4.567"));
     ObjectInspector[] inputOIs = {
@@ -488,7 +487,7 @@ public class TestGenericUDFOPPlus extends AbstractTestGenericUDFOPNumeric {
     // Date + day-time interval = timestamp
     PrimitiveObjectInspector oi = (PrimitiveObjectInspector) udf.initialize(inputOIs);
     Assert.assertEquals(TypeInfoFactory.timestampTypeInfo, oi.getTypeInfo());
-    TimestampWritable res = (TimestampWritable) udf.evaluate(args);
+    TimestampWritableV2 res = (TimestampWritableV2) udf.evaluate(args);
     Assert.assertEquals(Timestamp.valueOf("2001-01-02 2:3:4.567"), res.getTimestamp());
   }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFQuarter.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFQuarter.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFQuarter.java
index 4b09aa1..5e6c14e 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFQuarter.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFQuarter.java
@@ -17,16 +17,15 @@
  */
 package org.apache.hadoop.hive.ql.udf.generic;
 
-import java.sql.Date;
-import java.sql.Timestamp;
-
 import junit.framework.TestCase;
 
+import org.apache.hadoop.hive.common.type.Date;
+import org.apache.hadoop.hive.common.type.Timestamp;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
-import org.apache.hadoop.hive.serde2.io.DateWritable;
-import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+import org.apache.hadoop.hive.serde2.io.DateWritableV2;
+import org.apache.hadoop.hive.serde2.io.TimestampWritableV2;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.io.IntWritable;
@@ -83,22 +82,16 @@ public class TestGenericUDFQuarter extends TestCase {
   }
 
   public void testWrongDateStr() throws HiveException {
-    boolean caught = false;
-    try {
-      GenericUDFQuarter udf = new GenericUDFQuarter();
-      ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
-      ObjectInspector[] arguments = { valueOI0 };
-
-      udf.initialize(arguments);
-
-      runAndVerifyStr("2016-03-35", 2, udf);
-      runAndVerifyStr("2014-01-32", 1, udf);
-      runAndVerifyStr("01/14/2014", null, udf);
-      runAndVerifyStr(null, null, udf);
-    } catch (HiveException e) {
-      caught = true;
-    }
-    assertTrue(caught);
+    GenericUDFQuarter udf = new GenericUDFQuarter();
+    ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
+    ObjectInspector[] arguments = {valueOI0};
+
+    udf.initialize(arguments);
+
+    runAndVerifyStr("2016-03-35", 2, udf);
+    runAndVerifyStr("2014-01-32", 1, udf);
+    runAndVerifyStr("01/14/2014", null, udf);
+    runAndVerifyStr(null, null, udf);
   }
 
   public void testQuarterDt() throws HiveException {
@@ -166,7 +159,7 @@ public class TestGenericUDFQuarter extends TestCase {
   }
 
   private void runAndVerifyDt(String str, Integer expResult, GenericUDF udf) throws HiveException {
-    DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new DateWritable(
+    DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new DateWritableV2(
         Date.valueOf(str)) : null);
     DeferredObject[] args = { valueObj0 };
     IntWritable output = (IntWritable) udf.evaluate(args);
@@ -179,7 +172,7 @@ public class TestGenericUDFQuarter extends TestCase {
   }
 
   private void runAndVerifyTs(String str, Integer expResult, GenericUDF udf) throws HiveException {
-    DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new TimestampWritable(
+    DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new TimestampWritableV2(
         Timestamp.valueOf(str)) : null);
     DeferredObject[] args = { valueObj0 };
     IntWritable output = (IntWritable) udf.evaluate(args);

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFSortArray.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFSortArray.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFSortArray.java
index fcdb49c..5b6e2ab 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFSortArray.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFSortArray.java
@@ -18,14 +18,14 @@
 
 package org.apache.hadoop.hive.ql.udf.generic;
 
-import java.sql.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import static java.util.Arrays.asList;
 
+import org.apache.hadoop.hive.common.type.Date;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
-import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.DateWritableV2;
 import org.apache.hadoop.hive.serde2.io.DoubleWritable;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
@@ -93,22 +93,22 @@ public class TestGenericUDFSortArray {
     udf.initialize(inputOIs);
 
     Object i1 = asList(new Text("a"), new DoubleWritable(3.1415),
-        new DateWritable(new Date(2015, 5, 26)),
+        new DateWritableV2(Date.of(2015, 5, 26)),
         asList(new IntWritable(1), new IntWritable(3),
             new IntWritable(2), new IntWritable(4)));
 
     Object i2 = asList(new Text("b"), new DoubleWritable(3.14),
-        new DateWritable(new Date(2015, 5, 26)),
+        new DateWritableV2(Date.of(2015, 5, 26)),
         asList(new IntWritable(1), new IntWritable(3),
             new IntWritable(2), new IntWritable(4)));
 
     Object i3 = asList(new Text("a"), new DoubleWritable(3.1415),
-        new DateWritable(new Date(2015, 5, 25)),
+        new DateWritableV2(Date.of(2015, 5, 25)),
         asList(new IntWritable(1), new IntWritable(3),
             new IntWritable(2), new IntWritable(5)));
 
     Object i4 = asList(new Text("a"), new DoubleWritable(3.1415),
-        new DateWritable(new Date(2015, 5, 25)),
+        new DateWritableV2(Date.of(2015, 5, 25)),
         asList(new IntWritable(1), new IntWritable(3),
             new IntWritable(2), new IntWritable(4)));
 

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java
index d840238..61623d5 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestamp.java
@@ -18,14 +18,13 @@
 
 package org.apache.hadoop.hive.ql.udf.generic;
 
-import java.sql.Date;
-import java.sql.Timestamp;
-
+import org.apache.hadoop.hive.common.type.Date;
+import org.apache.hadoop.hive.common.type.Timestamp;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
-import org.apache.hadoop.hive.serde2.io.DateWritable;
-import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+import org.apache.hadoop.hive.serde2.io.DateWritableV2;
+import org.apache.hadoop.hive.serde2.io.TimestampWritableV2;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.io.LongWritable;
@@ -65,13 +64,13 @@ public class TestGenericUDFToUnixTimestamp extends TestCase {
 
     Timestamp ts = Timestamp.valueOf("1970-01-01 00:00:00");
     runAndVerify(udf,
-        new TimestampWritable(ts),
-        new LongWritable(ts.getTime() / 1000));
+        new TimestampWritableV2(ts),
+        new LongWritable(ts.toEpochSecond()));
 
     ts = Timestamp.valueOf("2001-02-03 01:02:03");
     runAndVerify(udf,
-        new TimestampWritable(ts),
-        new LongWritable(ts.getTime() / 1000));
+        new TimestampWritableV2(ts),
+        new LongWritable(ts.toEpochSecond()));
 
     // test null values
     runAndVerify(udf, null, null);
@@ -85,8 +84,8 @@ public class TestGenericUDFToUnixTimestamp extends TestCase {
 
     Date date = Date.valueOf("1970-01-01");
     runAndVerify(udf,
-        new DateWritable(date),
-        new LongWritable(date.getTime() / 1000));
+        new DateWritableV2(date),
+        new LongWritable(date.toEpochSecond()));
 
     // test null values
     runAndVerify(udf, null, null);
@@ -101,7 +100,7 @@ public class TestGenericUDFToUnixTimestamp extends TestCase {
     String val = "2001-01-01 01:02:03";
     runAndVerify(udf1,
         new Text(val),
-        new LongWritable(Timestamp.valueOf(val).getTime() / 1000));
+        new LongWritable(Timestamp.valueOf(val).toEpochSecond()));
 
     // test null values
     runAndVerify(udf1, null, null);
@@ -116,7 +115,7 @@ public class TestGenericUDFToUnixTimestamp extends TestCase {
     runAndVerify(udf2,
         new Text(val),
         new Text(format),
-        new LongWritable(Date.valueOf(val).getTime() / 1000));
+        new LongWritable(Date.valueOf(val).toEpochSecond()));
 
     // test null values
     runAndVerify(udf2, null, null, null);

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFTrunc.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFTrunc.java b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFTrunc.java
index 0d524d3..86511a6 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFTrunc.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFTrunc.java
@@ -18,14 +18,13 @@
 
 package org.apache.hadoop.hive.ql.udf.generic;
 
-import java.sql.Date;
-import java.sql.Timestamp;
-
+import org.apache.hadoop.hive.common.type.Date;
+import org.apache.hadoop.hive.common.type.Timestamp;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
-import org.apache.hadoop.hive.serde2.io.DateWritable;
-import org.apache.hadoop.hive.serde2.io.TimestampWritable;
+import org.apache.hadoop.hive.serde2.io.DateWritableV2;
+import org.apache.hadoop.hive.serde2.io.TimestampWritableV2;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.apache.hadoop.io.Text;
@@ -304,83 +303,83 @@ public class TestGenericUDFTrunc extends TestCase {
     DeferredObject[] evalArgs;
 
     // test date string
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-01 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-14 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-31 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-02 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-28 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-03 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-28 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-29 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
     // test timestamp string
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-01 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-14 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-31 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-02 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-28 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-03 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-28 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-29 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
@@ -398,113 +397,113 @@ public class TestGenericUDFTrunc extends TestCase {
     DeferredObject[] evalArgs;
 
     // test date string
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-01 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-14 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-31 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-02 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-28 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-03 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-28 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-29 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-05-11 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-04-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-07-01 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-07-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-12-31 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-10-01", udf, initArgs, evalArgs);
 
     // test timestamp string
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-01 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-14 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-31 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-02 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-28 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-03 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-28 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-29 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-05-11 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-04-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-07-01 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-07-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-12-31 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-10-01", udf, initArgs, evalArgs);
@@ -522,83 +521,83 @@ public class TestGenericUDFTrunc extends TestCase {
     DeferredObject[] evalArgs;
 
     // test date string
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-01 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-14 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-31 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-02 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-28 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-03 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-28 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-29 00:00:00")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
     // test timestamp string
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-01 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-14 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-01-31 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-02 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2014-02-28 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-03 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-28 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new TimestampWritable(
+    valueObj0 = new DeferredJavaObject(new TimestampWritableV2(
         Timestamp.valueOf("2016-02-29 10:30:45")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
@@ -616,35 +615,35 @@ public class TestGenericUDFTrunc extends TestCase {
     DeferredObject[] evalArgs;
 
     // test date string
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-01")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-01")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-14")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-14")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-31")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-31")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-02-02")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-02-02")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-02-28")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-02-28")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-03")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-03")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-28")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-28")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-29")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-29")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-02-01", udf, initArgs, evalArgs);
   }
@@ -661,47 +660,47 @@ public class TestGenericUDFTrunc extends TestCase {
     DeferredObject[] evalArgs;
 
     // test date string
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-01")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-01")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-14")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-14")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-31")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-31")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-02-02")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-02-02")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-02-28")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-02-28")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-03")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-03")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-28")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-28")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-29")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-29")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-05-11")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-05-11")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-04-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-07-01")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-07-01")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-07-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-12-31")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-12-31")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-10-01", udf, initArgs, evalArgs);
   }
@@ -718,35 +717,35 @@ public class TestGenericUDFTrunc extends TestCase {
     DeferredObject[] evalArgs;
 
     // test date string
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-01")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-01")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-14")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-14")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-01-31")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-01-31")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-02-02")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-02-02")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2014-02-28")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2014-02-28")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2014-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-03")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-03")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-28")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-28")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
 
-    valueObj0 = new DeferredJavaObject(new DateWritable(Date.valueOf("2016-02-29")));
+    valueObj0 = new DeferredJavaObject(new DateWritableV2(Date.valueOf("2016-02-29")));
     evalArgs = new DeferredObject[] { valueObj0, valueObjFmt };
     runAndVerify("2016-01-01", udf, initArgs, evalArgs);
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java b/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java
index 85bb9b3..d0bd08c 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/util/TestDateTimeMath.java
@@ -17,11 +17,11 @@
  */
 package org.apache.hadoop.hive.ql.util;
 
-import java.sql.Date;
-import java.sql.Timestamp;
 import java.util.TimeZone;
 
+import org.apache.hadoop.hive.common.type.Date;
 import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
+import org.apache.hadoop.hive.common.type.Timestamp;
 import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
 import org.apache.hadoop.hive.ql.util.DateTimeMath;
 import org.junit.*;
@@ -92,9 +92,9 @@ public class TestDateTimeMath {
     try {
       TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
       checkTimestampIntervalYearMonthArithmetic("2001-01-01 01:02:03", plus, "0-6",
-          "2001-07-01 02:02:03");
+          "2001-07-01 01:02:03");
         checkTimestampIntervalYearMonthArithmetic("2001-07-01 01:02:03", plus, "0-6",
-          "2002-01-01 00:02:03");
+          "2002-01-01 01:02:03");
 
       TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
       checkTimestampIntervalYearMonthArithmetic("2001-01-01 01:02:03", plus, "0-6",
@@ -215,15 +215,15 @@ public class TestDateTimeMath {
       checkTsIntervalDayTimeArithmetic("2015-03-08 01:59:58", plus, "0 0:0:01",
           "2015-03-08 01:59:59");
       checkTsIntervalDayTimeArithmetic("2015-03-08 01:59:59", plus, "0 0:0:01",
-          "2015-03-08 03:00:00");
+          "2015-03-08 02:00:00");
       checkTsIntervalDayTimeArithmetic("2015-03-08 03:00:00", minus, "0 0:0:01",
-          "2015-03-08 01:59:59");
+          "2015-03-08 02:59:59");
       checkTsIntervalDayTimeArithmetic("2015-03-08 01:59:59.995", plus, "0 0:0:0.005",
-          "2015-03-08 03:00:00");
+          "2015-03-08 02:00:00");
       checkTsIntervalDayTimeArithmetic("2015-03-08 01:59:59.995", plus, "0 0:0:0.0051",
-          "2015-03-08 03:00:00.0001");
+          "2015-03-08 02:00:00.0001");
       checkTsIntervalDayTimeArithmetic("2015-03-08 03:00:00", minus, "0 0:0:0.005",
-          "2015-03-08 01:59:59.995");
+          "2015-03-08 02:59:59.995");
       checkTsIntervalDayTimeArithmetic("2015-11-01 01:59:58", plus, "0 0:0:01",
           "2015-11-01 01:59:59");
       checkTsIntervalDayTimeArithmetic("2015-11-01 01:59:59", plus, "0 0:0:01",
@@ -286,10 +286,10 @@ public class TestDateTimeMath {
     TimeZone originalTz = TimeZone.getDefault();
     try {
       TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
-      checkTsArithmetic("1999-12-15 00:00:00", "1999-09-15 00:00:00", "91 1:0:0");
-      checkTsArithmetic("1999-09-15 00:00:00", "1999-12-15 00:00:00", "-91 1:0:0");
-      checkTsArithmetic("1999-12-15 00:00:00", "1995-09-15 00:00:00", "1552 1:0:0");
-      checkTsArithmetic("1995-09-15 00:00:00", "1999-12-15 00:00:00", "-1552 1:0:0");
+      checkTsArithmetic("1999-12-15 00:00:00", "1999-09-15 00:00:00", "91 0:0:0");
+      checkTsArithmetic("1999-09-15 00:00:00", "1999-12-15 00:00:00", "-91 0:0:0");
+      checkTsArithmetic("1999-12-15 00:00:00", "1995-09-15 00:00:00", "1552 0:0:0");
+      checkTsArithmetic("1995-09-15 00:00:00", "1999-12-15 00:00:00", "-1552 0:0:0");
 
       TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
       checkTsArithmetic("1999-12-15 00:00:00", "1999-09-15 00:00:00", "91 0:0:0");

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientnegative/date_literal3.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientnegative/date_literal3.q b/ql/src/test/queries/clientnegative/date_literal3.q
deleted file mode 100644
index e5a241d..0000000
--- a/ql/src/test/queries/clientnegative/date_literal3.q
+++ /dev/null
@@ -1,3 +0,0 @@
---! qt:dataset:src
--- Invalid date value
-SELECT DATE '2001-01-32' FROM src;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/change_allowincompatible_vectorization_false_date.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/change_allowincompatible_vectorization_false_date.q b/ql/src/test/queries/clientpositive/change_allowincompatible_vectorization_false_date.q
new file mode 100644
index 0000000..e750c59
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/change_allowincompatible_vectorization_false_date.q
@@ -0,0 +1,29 @@
+--! qt:dataset:alltypesorc
+
+set hive.vectorized.execution.enabled=false;
+set hive.support.concurrency=true;
+set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
+set hive.tez.bucket.pruning=true;
+set hive.optimize.index.filter=true;
+set hive.metastore.disallow.incompatible.col.type.changes=false;
+
+create table change_allowincompatible_vectorization_false_date (ts date) partitioned by (s string) clustered by (ts) into 32 buckets stored as orc tblproperties ('transactional'='true');
+
+alter table change_allowincompatible_vectorization_false_date add partition(s='aaa');
+
+alter table change_allowincompatible_vectorization_false_date add partition(s='bbb');
+
+insert into table change_allowincompatible_vectorization_false_date partition (s='aaa') select ctimestamp1 from alltypesorc where ctimestamp1 > '2000-01-01' limit 50;
+
+insert into table change_allowincompatible_vectorization_false_date partition (s='bbb') select ctimestamp1 from alltypesorc where ctimestamp1 < '2000-01-01' limit 50;
+
+select count(*) from change_allowincompatible_vectorization_false_date;
+
+alter table change_allowincompatible_vectorization_false_date change column ts ts timestamp;
+
+select count(*) from change_allowincompatible_vectorization_false_date;
+
+insert into table change_allowincompatible_vectorization_false_date partition (s='aaa') values ('2038-03-22 07:26:48.0');
+
+select ts from change_allowincompatible_vectorization_false_date where ts='2038-03-22 07:26:48.0' and s='aaa';
+

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/date_udf.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/date_udf.q b/ql/src/test/queries/clientpositive/date_udf.q
index cddfc1a..aa33b7a 100644
--- a/ql/src/test/queries/clientpositive/date_udf.q
+++ b/ql/src/test/queries/clientpositive/date_udf.q
@@ -21,7 +21,7 @@ create table date_udf_flight (
 LOAD DATA LOCAL INPATH '../../data/files/flights_tiny.txt.1' OVERWRITE INTO TABLE date_udf_flight;
 
 -- Test UDFs with date input
-select unix_timestamp(d), year(d), month(d), day(d), dayofmonth(d),
+select unix_timestamp(cast(d as timestamp with local time zone)), unix_timestamp(d), year(d), month(d), day(d), dayofmonth(d),
     weekofyear(d), to_date(d)
   from date_udf;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/druid_timestamptz2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/druid_timestamptz2.q b/ql/src/test/queries/clientpositive/druid_timestamptz2.q
new file mode 100644
index 0000000..8f573c8
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/druid_timestamptz2.q
@@ -0,0 +1,60 @@
+CREATE database druid_test_dst;
+use druid_test_dst;
+
+
+
+create table test_base_table(`timecolumn` timestamp, `interval_marker` string, `num_l` double);
+insert into test_base_table values ('2015-03-08 00:00:00', 'i1-start', 4);
+insert into test_base_table values ('2015-03-08 23:59:59', 'i1-end', 1);
+insert into test_base_table values ('2015-03-09 00:00:00', 'i2-start', 4);
+insert into test_base_table values ('2015-03-09 23:59:59', 'i2-end', 1);
+insert into test_base_table values ('2015-03-10 00:00:00', 'i3-start', 2);
+insert into test_base_table values ('2015-03-10 23:59:59', 'i3-end', 2);
+
+CREATE TABLE druid_test_table_1
+STORED BY 'org.apache.hadoop.hive.druid.DruidStorageHandler'
+TBLPROPERTIES ("druid.segment.granularity" = "DAY")
+AS
+select cast(`timecolumn` as timestamp with local time zone) as `__time`, `interval_marker`, `num_l`
+FROM druid_test_dst.test_base_table;
+
+select * FROM druid_test_table_1;
+
+CREATE TABLE druid_test_table_2 (`__time` timestamp with local time zone, `interval_marker` string, `num_l` double)
+STORED BY 'org.apache.hadoop.hive.druid.DruidStorageHandler'
+TBLPROPERTIES ("druid.segment.granularity" = "DAY");
+
+
+insert into druid_test_table_2 values (cast('2015-03-08 00:00:00' as timestamp with local time zone), 'i1-start', 4);
+insert into druid_test_table_2 values (cast('2015-03-08 23:59:59' as timestamp with local time zone), 'i1-end', 1);
+insert into druid_test_table_2 values (cast('2015-03-09 00:00:00' as timestamp with local time zone), 'i2-start', 4);
+insert into druid_test_table_2 values (cast('2015-03-09 23:59:59' as timestamp with local time zone), 'i2-end', 1);
+insert into druid_test_table_2 values (cast('2015-03-10 00:00:00' as timestamp with local time zone), 'i3-start', 2);
+insert into druid_test_table_2 values (cast('2015-03-10 23:59:59' as timestamp with local time zone), 'i3-end', 2);
+
+select * FROM druid_test_table_2;
+
+SET TIME ZONE UTC;
+
+CREATE TABLE druid_test_table_utc
+STORED BY 'org.apache.hadoop.hive.druid.DruidStorageHandler'
+TBLPROPERTIES ("druid.segment.granularity" = "DAY")
+AS
+select cast(`timecolumn` as timestamp with local time zone) as `__time`, `interval_marker`, `num_l`
+FROM druid_test_dst.test_base_table;
+
+select * FROM druid_test_table_utc;
+
+CREATE TABLE druid_test_table_utc2 (`__time` timestamp with local time zone, `interval_marker` string, `num_l` double)
+STORED BY 'org.apache.hadoop.hive.druid.DruidStorageHandler'
+TBLPROPERTIES ("druid.segment.granularity" = "DAY");
+
+
+insert into druid_test_table_utc2 values (cast('2015-03-08 00:00:00' as timestamp with local time zone), 'i1-start', 4);
+insert into druid_test_table_utc2 values (cast('2015-03-08 23:59:59' as timestamp with local time zone), 'i1-end', 1);
+insert into druid_test_table_utc2 values (cast('2015-03-09 00:00:00' as timestamp with local time zone), 'i2-start', 4);
+insert into druid_test_table_utc2 values (cast('2015-03-09 23:59:59' as timestamp with local time zone), 'i2-end', 1);
+insert into druid_test_table_utc2 values (cast('2015-03-10 00:00:00' as timestamp with local time zone), 'i3-start', 2);
+insert into druid_test_table_utc2 values (cast('2015-03-10 23:59:59' as timestamp with local time zone), 'i3-end', 2);
+
+select * FROM druid_test_table_utc2;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/localtimezone.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/localtimezone.q b/ql/src/test/queries/clientpositive/localtimezone.q
index 27b036b..7456972 100644
--- a/ql/src/test/queries/clientpositive/localtimezone.q
+++ b/ql/src/test/queries/clientpositive/localtimezone.q
@@ -5,35 +5,35 @@ drop table `timestamptz_test`;
 create table `date_test` (`mydate1` date);
 
 insert into `date_test` VALUES
-  ('2011-01-01 01:01:01.123'),
-  ('2011-01-01 01:01:01.123 Europe/Rome'),
-  ('2011-01-01 01:01:01.123 GMT-05:00'),
-  ('2011-01-01 01:01:01.12345678912'),
-  ('2011-01-01 01:01:01.12345678912 Europe/Rome'),
-  ('2011-01-01 01:01:01.12345678912 GMT-05:00'),
-  ('2011-01-01 01:01:01.12345678912 xyz');
+  (cast('2011-01-01 01:01:01.123' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.123 Europe/Rome' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.123 GMT-05:00' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 Europe/Rome' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 GMT-05:00' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 xyz' as timestamp with local time zone));
 
 create table `timestamp_test` (`mydate1` timestamp);
 
 insert into `timestamp_test` VALUES
-  ('2011-01-01 01:01:01.123'),
-  ('2011-01-01 01:01:01.123 Europe/Rome'),
-  ('2011-01-01 01:01:01.123 GMT-05:00'),
-  ('2011-01-01 01:01:01.12345678912'),
-  ('2011-01-01 01:01:01.12345678912 Europe/Rome'),
-  ('2011-01-01 01:01:01.12345678912 GMT-05:00'),
-  ('2011-01-01 01:01:01.12345678912 xyz');
+  (cast('2011-01-01 01:01:01.123' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.123 Europe/Rome' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.123 GMT-05:00' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 Europe/Rome' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 GMT-05:00' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 xyz' as timestamp with local time zone));
 
 create table `timestamptz_test` (`mydate1` timestamp with local time zone);
 
 insert into `timestamptz_test` VALUES
-  ('2011-01-01 01:01:01.123'),
-  ('2011-01-01 01:01:01.123 Europe/Rome'),
-  ('2011-01-01 01:01:01.123 GMT-05:00'),
-  ('2011-01-01 01:01:01.12345678912'),
-  ('2011-01-01 01:01:01.12345678912 Europe/Rome'),
-  ('2011-01-01 01:01:01.12345678912 GMT-05:00'),
-  ('2011-01-01 01:01:01.12345678912 xyz');
+  (cast('2011-01-01 01:01:01.123' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.123 Europe/Rome' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.123 GMT-05:00' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 Europe/Rome' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 GMT-05:00' as timestamp with local time zone)),
+  (cast('2011-01-01 01:01:01.12345678912 xyz' as timestamp with local time zone));
 
 select * from `date_test`;
 select * from `timestamp_test`;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/localtimezone2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/localtimezone2.q b/ql/src/test/queries/clientpositive/localtimezone2.q
new file mode 100644
index 0000000..911fca0
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/localtimezone2.q
@@ -0,0 +1,55 @@
+drop table `table_tsltz`;
+
+CREATE TABLE table_tsltz (tz VARCHAR(200),
+                         c_ts1 TIMESTAMP,
+                         c_ts2 TIMESTAMP,
+                         c_tsltz1 TIMESTAMP WITH LOCAL TIME ZONE,
+                         c_tsltz2 TIMESTAMP WITH LOCAL TIME ZONE);
+
+set time zone GMT-08:00;
+
+insert into table_tsltz values (
+  '-08:00',
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone),
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone));
+
+set time zone UTC;
+
+insert into table_tsltz values (
+  'UTC',
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone),
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone));
+
+set time zone GMT+02:00;
+
+insert into table_tsltz values (
+  '+02:00',
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone),
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone));
+
+set time zone US/Pacific;
+
+insert into table_tsltz values (
+  'US/Pacific',
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone),
+  cast('2016-01-01 00:00:00' as timestamp),
+  cast('2016-01-01 00:00:00 -05:00' as timestamp with local time zone));
+
+select tz,
+    c_ts1, c_ts2,
+    cast(c_tsltz1 as VARCHAR(200)) as c_tsltz1, cast(c_tsltz2 as VARCHAR(200)) as c_tsltz2
+from table_tsltz;
+
+set time zone UTC;
+
+select tz,
+    c_ts1, c_ts2,
+    cast(c_tsltz1 as VARCHAR(200)) as c_tsltz1, cast(c_tsltz2 as VARCHAR(200)) as c_tsltz2
+from table_tsltz;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/parquet_ppd_char.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/parquet_ppd_char.q b/ql/src/test/queries/clientpositive/parquet_ppd_char.q
index 386fb25..4230d8c 100644
--- a/ql/src/test/queries/clientpositive/parquet_ppd_char.q
+++ b/ql/src/test/queries/clientpositive/parquet_ppd_char.q
@@ -1,6 +1,7 @@
 --! qt:dataset:src1
 --! qt:dataset:src
 
+set hive.parquet.timestamp.skip.conversion=true;
 set hive.vectorized.execution.enabled=false;
 SET hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
 SET hive.optimize.ppd=true;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/parquet_vectorization_13.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/parquet_vectorization_13.q b/ql/src/test/queries/clientpositive/parquet_vectorization_13.q
index e5f48c8..0b23f50 100644
--- a/ql/src/test/queries/clientpositive/parquet_vectorization_13.q
+++ b/ql/src/test/queries/clientpositive/parquet_vectorization_13.q
@@ -32,8 +32,8 @@ FROM     alltypesparquet
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > 11)
-              AND ((ctimestamp2 != 12)
+          OR ((ctimestamp1 > -28789)
+              AND ((ctimestamp2 != -28788)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16
@@ -64,8 +64,8 @@ FROM     alltypesparquet
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > 11)
-              AND ((ctimestamp2 != 12)
+          OR ((ctimestamp1 > -28789)
+              AND ((ctimestamp2 != -28788)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16
@@ -98,8 +98,8 @@ FROM     alltypesparquet
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > -1.388)
-              AND ((ctimestamp2 != -1.3359999999999999)
+          OR ((ctimestamp1 > -28801.388)
+              AND ((ctimestamp2 != -28801.3359999999999999)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16
@@ -130,8 +130,8 @@ FROM     alltypesparquet
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > -1.388)
-              AND ((ctimestamp2 != -1.3359999999999999)
+          OR ((ctimestamp1 > -28801.388)
+              AND ((ctimestamp2 != -28801.3359999999999999)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/parquet_vectorization_7.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/parquet_vectorization_7.q b/ql/src/test/queries/clientpositive/parquet_vectorization_7.q
index d0a73a3..55f21af 100644
--- a/ql/src/test/queries/clientpositive/parquet_vectorization_7.q
+++ b/ql/src/test/queries/clientpositive/parquet_vectorization_7.q
@@ -24,11 +24,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesparquet
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0)
+        AND (((ctimestamp1 <= -28800)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > -15)
+              OR ((ctimestamp2 > -28815)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;
@@ -50,11 +50,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesparquet
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0)
+        AND (((ctimestamp1 <= -28800)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > -15)
+              OR ((ctimestamp2 > -28815)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;
@@ -79,11 +79,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesparquet
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0.0)
+        AND (((ctimestamp1 <= -28800.0)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > 7.6850000000000005)
+              OR ((ctimestamp2 > -28792.3149999999999995)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;
@@ -105,11 +105,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesparquet
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0.0)
+        AND (((ctimestamp1 <= -28800.0)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > 7.6850000000000005)
+              OR ((ctimestamp2 > -28792.3149999999999995)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/singletsinsertorc.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/singletsinsertorc.q b/ql/src/test/queries/clientpositive/singletsinsertorc.q
new file mode 100644
index 0000000..3e4c43e
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/singletsinsertorc.q
@@ -0,0 +1,6 @@
+CREATE TABLE myorctable(ts timestamp)
+STORED AS ORC;
+
+INSERT INTO myorctable VALUES ('1970-01-01 00:00:00');
+
+SELECT * FROM myorctable;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/timestamp_comparison2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/timestamp_comparison2.q b/ql/src/test/queries/clientpositive/timestamp_comparison2.q
index affc36f..dfb4fd7 100644
--- a/ql/src/test/queries/clientpositive/timestamp_comparison2.q
+++ b/ql/src/test/queries/clientpositive/timestamp_comparison2.q
@@ -17,8 +17,8 @@ FROM   alltypesorc
 WHERE  
 ((ctinyint != 0)
     AND 
-        (((ctimestamp1 <= timestamp('1969-12-31 16:00:00')) 
+        (((ctimestamp1 <= timestamp('1970-01-01 00:00:00'))
             OR ((ctinyint = cint) OR (cstring2 LIKE 'ss')))
          AND ((988888 < cdouble)
-             OR ((ctimestamp2 > timestamp('1969-12-31 07:55:29')) AND (3569 >= cdouble)))))
+             OR ((ctimestamp2 > timestamp('1969-12-31 15:55:29')) AND (3569 >= cdouble)))))
 ;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/timestamp_dst.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/timestamp_dst.q b/ql/src/test/queries/clientpositive/timestamp_dst.q
new file mode 100644
index 0000000..4dda5a9
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamp_dst.q
@@ -0,0 +1,2 @@
+select TIMESTAMP '2015-03-08 02:10:00.101';
+

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/udf_reflect2.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/udf_reflect2.q b/ql/src/test/queries/clientpositive/udf_reflect2.q
index 7ebe914..7810746 100644
--- a/ql/src/test/queries/clientpositive/udf_reflect2.q
+++ b/ql/src/test/queries/clientpositive/udf_reflect2.q
@@ -36,7 +36,7 @@ SELECT key,
        reflect2(ts, "getHours"),
        reflect2(ts, "getMinutes"),
        reflect2(ts, "getSeconds"),
-       reflect2(ts, "getTime")
+       reflect2(ts, "toEpochMilli")
 FROM (select cast(key as int) key, value, cast('2013-02-15 19:41:20' as timestamp) ts from src) a LIMIT 5;
 
 
@@ -70,5 +70,5 @@ SELECT key,
        reflect2(ts, "getHours"),
        reflect2(ts, "getMinutes"),
        reflect2(ts, "getSeconds"),
-       reflect2(ts, "getTime")
+       reflect2(ts, "toEpochMilli")
 FROM (select cast(key as int) key, value, cast('2013-02-15 19:41:20' as timestamp) ts from src) a LIMIT 5;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/vectorization_13.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/vectorization_13.q b/ql/src/test/queries/clientpositive/vectorization_13.q
index dd7981d..b9e3fa2 100644
--- a/ql/src/test/queries/clientpositive/vectorization_13.q
+++ b/ql/src/test/queries/clientpositive/vectorization_13.q
@@ -32,8 +32,8 @@ FROM     alltypesorc
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > 11)
-              AND ((ctimestamp2 != 12)
+          OR ((ctimestamp1 > -28789)
+              AND ((ctimestamp2 != -28788)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16
@@ -64,8 +64,8 @@ FROM     alltypesorc
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > 11)
-              AND ((ctimestamp2 != 12)
+          OR ((ctimestamp1 > -28789)
+              AND ((ctimestamp2 != -28788)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16
@@ -98,8 +98,8 @@ FROM     alltypesorc
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > -1.388)
-              AND ((ctimestamp2 != -1.3359999999999999)
+          OR ((ctimestamp1 > -28801.388)
+              AND ((ctimestamp2 != -28801.3359999999999999)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16
@@ -130,8 +130,8 @@ FROM     alltypesorc
 WHERE    (((cfloat < 3569)
            AND ((10.175 >= cdouble)
                 AND (cboolean1 != 1)))
-          OR ((ctimestamp1 > -1.388)
-              AND ((ctimestamp2 != -1.3359999999999999)
+          OR ((ctimestamp1 > -28801.388)
+              AND ((ctimestamp2 != -28801.3359999999999999)
                    AND (ctinyint < 9763215.5639))))
 GROUP BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1
 ORDER BY cboolean1, ctinyint, ctimestamp1, cfloat, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/vectorization_7.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/vectorization_7.q b/ql/src/test/queries/clientpositive/vectorization_7.q
index ac0cc10..855e2cf 100644
--- a/ql/src/test/queries/clientpositive/vectorization_7.q
+++ b/ql/src/test/queries/clientpositive/vectorization_7.q
@@ -24,11 +24,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesorc
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0)
+        AND (((ctimestamp1 <= -28800)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > -15)
+              OR ((ctimestamp2 > -28815)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;
@@ -50,11 +50,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesorc
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0)
+        AND (((ctimestamp1 <= -28800)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > -15)
+              OR ((ctimestamp2 > -28815)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;
@@ -79,11 +79,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesorc
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0.0)
+        AND (((ctimestamp1 <= -28800.0)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > 7.6850000000000005)
+              OR ((ctimestamp2 > -28792.3149999999999995)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;
@@ -105,11 +105,11 @@ SELECT cboolean1,
        ((-(ctinyint)) % ctinyint) as c9
 FROM   alltypesorc
 WHERE  ((ctinyint != 0)
-        AND (((ctimestamp1 <= 0.0)
+        AND (((ctimestamp1 <= -28800.0)
           OR ((ctinyint = cint)
                OR (cstring2 LIKE 'ss')))
           AND ((988888 < cdouble)
-              OR ((ctimestamp2 > 7.6850000000000005)
+              OR ((ctimestamp2 > -28792.3149999999999995)
                   AND (3569 >= cdouble)))))
 ORDER BY cboolean1, cbigint, csmallint, ctinyint, ctimestamp1, cstring1, c1, c2, c3, c4, c5, c6, c7, c8, c9
 LIMIT 25;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/queries/clientpositive/vectorization_decimal_date.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/vectorization_decimal_date.q b/ql/src/test/queries/clientpositive/vectorization_decimal_date.q
index c38ef09..68e5576 100644
--- a/ql/src/test/queries/clientpositive/vectorization_decimal_date.q
+++ b/ql/src/test/queries/clientpositive/vectorization_decimal_date.q
@@ -4,5 +4,6 @@ set hive.fetch.task.conversion=none;
 
 CREATE TABLE date_decimal_test STORED AS ORC AS SELECT cint, cdouble, CAST (CAST (cint AS TIMESTAMP) AS DATE) AS cdate, CAST (((cdouble*22.1)/37) AS DECIMAL(20,10)) AS cdecimal FROM alltypesorc;
 SET hive.vectorized.execution.enabled=true;
-EXPLAIN VECTORIZATION EXPRESSION  SELECT cdate, cdecimal from date_decimal_test where cint IS NOT NULL AND cdouble IS NOT NULL LIMIT 10;
-SELECT cdate, cdecimal from date_decimal_test where cint IS NOT NULL AND cdouble IS NOT NULL LIMIT 10;
+EXPLAIN VECTORIZATION EXPRESSION  SELECT cdate, cint, cdecimal from date_decimal_test where cint IS NOT NULL AND cdouble IS NOT NULL LIMIT 10;
+-- 528534767 is 'Wednesday, January 7, 1970 2:48:54 AM'
+SELECT cdate, cint, cdecimal from date_decimal_test where cint IS NOT NULL AND cdouble IS NOT NULL LIMIT 10;

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/results/clientnegative/date_literal3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/date_literal3.q.out b/ql/src/test/results/clientnegative/date_literal3.q.out
deleted file mode 100644
index f51de7c..0000000
--- a/ql/src/test/results/clientnegative/date_literal3.q.out
+++ /dev/null
@@ -1 +0,0 @@
-FAILED: SemanticException Unable to convert time literal '2001-01-32' to time value.

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/results/clientpositive/beeline/udf_unix_timestamp.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/beeline/udf_unix_timestamp.q.out b/ql/src/test/results/clientpositive/beeline/udf_unix_timestamp.q.out
index c86a85c..e768eca 100644
--- a/ql/src/test/results/clientpositive/beeline/udf_unix_timestamp.q.out
+++ b/ql/src/test/results/clientpositive/beeline/udf_unix_timestamp.q.out
@@ -41,7 +41,7 @@ FROM oneline
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@oneline
 #### A masked pattern was here ####
-2009-03-20 11:30:01	1237573801
+2009-03-20 11:30:01	1237548601
 PREHOOK: query: SELECT
   '2009-03-20',
   unix_timestamp('2009-03-20', 'yyyy-MM-dd')
@@ -56,7 +56,7 @@ FROM oneline
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@oneline
 #### A masked pattern was here ####
-2009-03-20	1237532400
+2009-03-20	1237507200
 PREHOOK: query: SELECT
   '2009 Mar 20 11:30:01 am',
   unix_timestamp('2009 Mar 20 11:30:01 am', 'yyyy MMM dd h:mm:ss a')
@@ -71,7 +71,7 @@ FROM oneline
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@oneline
 #### A masked pattern was here ####
-2009 Mar 20 11:30:01 am	1237573801
+2009 Mar 20 11:30:01 am	1237548601
 unix_timestamp(void) is deprecated. Use current_timestamp instead.
 unix_timestamp(void) is deprecated. Use current_timestamp instead.
 PREHOOK: query: create table foo_n3 as SELECT

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/results/clientpositive/cast_on_constant.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cast_on_constant.q.out b/ql/src/test/results/clientpositive/cast_on_constant.q.out
index 465bd15..bdb03f7 100644
--- a/ql/src/test/results/clientpositive/cast_on_constant.q.out
+++ b/ql/src/test/results/clientpositive/cast_on_constant.q.out
@@ -20,13 +20,13 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: t1_n138
-            filterExpr: (ts_field = TIMESTAMP'2016-01-23 00:00:00.0') (type: boolean)
+            filterExpr: (ts_field = TIMESTAMP'2016-01-23 00:00:00') (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
-              predicate: (ts_field = TIMESTAMP'2016-01-23 00:00:00.0') (type: boolean)
+              predicate: (ts_field = TIMESTAMP'2016-01-23 00:00:00') (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: TIMESTAMP'2016-01-23 00:00:00.0' (type: timestamp), date_field (type: date)
+                expressions: TIMESTAMP'2016-01-23 00:00:00' (type: timestamp), date_field (type: date)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 File Output Operator
@@ -96,13 +96,13 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             alias: t1_n138
-            filterExpr: (ts_field = TIMESTAMP'2016-01-23 00:00:00.0') (type: boolean)
+            filterExpr: (ts_field = TIMESTAMP'2016-01-23 00:00:00') (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
-              predicate: (ts_field = TIMESTAMP'2016-01-23 00:00:00.0') (type: boolean)
+              predicate: (ts_field = TIMESTAMP'2016-01-23 00:00:00') (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: TIMESTAMP'2016-01-23 00:00:00.0' (type: timestamp), date_field (type: date)
+                expressions: TIMESTAMP'2016-01-23 00:00:00' (type: timestamp), date_field (type: date)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/results/clientpositive/confirm_initial_tbl_stats.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/confirm_initial_tbl_stats.q.out b/ql/src/test/results/clientpositive/confirm_initial_tbl_stats.q.out
index 3d64168..e97e97d 100644
--- a/ql/src/test/results/clientpositive/confirm_initial_tbl_stats.q.out
+++ b/ql/src/test/results/clientpositive/confirm_initial_tbl_stats.q.out
@@ -272,10 +272,10 @@ POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@alltypesorc
 col_name            	ctimestamp1         	 	 	 	 	 	 	 	 	 	 
 data_type           	timestamp           	 	 	 	 	 	 	 	 	 	 
-min                 	-30                 	 	 	 	 	 	 	 	 	 	 
-max                 	31                  	 	 	 	 	 	 	 	 	 	 
+min                 	-28830              	 	 	 	 	 	 	 	 	 	 
+max                 	-28769              	 	 	 	 	 	 	 	 	 	 
 num_nulls           	3115                	 	 	 	 	 	 	 	 	 	 
-distinct_count      	36                  	 	 	 	 	 	 	 	 	 	 
+distinct_count      	35                  	 	 	 	 	 	 	 	 	 	 
 avg_col_len         	                    	 	 	 	 	 	 	 	 	 	 
 max_col_len         	                    	 	 	 	 	 	 	 	 	 	 
 num_trues           	                    	 	 	 	 	 	 	 	 	 	 

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/results/clientpositive/constprog_type.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/constprog_type.q.out b/ql/src/test/results/clientpositive/constprog_type.q.out
index 99a4746..a3f6358 100644
--- a/ql/src/test/results/clientpositive/constprog_type.q.out
+++ b/ql/src/test/results/clientpositive/constprog_type.q.out
@@ -35,7 +35,7 @@ STAGE PLANS:
             Row Limit Per Split: 1
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: COMPLETE
             Select Operator
-              expressions: DATE'2013-11-17' (type: date), TIMESTAMP'2011-04-29 20:46:56.4485' (type: timestamp)
+              expressions: DATE'2013-11-17' (type: date), TIMESTAMP'2011-04-30 03:46:56.4485' (type: timestamp)
               outputColumnNames: _col0, _col1
               Statistics: Num rows: 500 Data size: 48000 Basic stats: COMPLETE Column stats: COMPLETE
               File Output Operator
@@ -123,7 +123,7 @@ POSTHOOK: query: SELECT * FROM dest1_n26
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@dest1_n26
 #### A masked pattern was here ####
-2013-11-17	2011-04-29 20:46:56.4485
+2013-11-17	2011-04-30 03:46:56.4485
 PREHOOK: query: SELECT key, value FROM src WHERE key = cast(86 as double)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src

http://git-wip-us.apache.org/repos/asf/hive/blob/ae008b79/ql/src/test/results/clientpositive/date_udf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/date_udf.q.out b/ql/src/test/results/clientpositive/date_udf.q.out
index 37ad29e..7681a50 100644
--- a/ql/src/test/results/clientpositive/date_udf.q.out
+++ b/ql/src/test/results/clientpositive/date_udf.q.out
@@ -74,19 +74,19 @@ POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/flights_tiny.txt.1' OV
 POSTHOOK: type: LOAD
 #### A masked pattern was here ####
 POSTHOOK: Output: default@date_udf_flight
-PREHOOK: query: select unix_timestamp(d), year(d), month(d), day(d), dayofmonth(d),
+PREHOOK: query: select unix_timestamp(cast(d as timestamp with local time zone)), unix_timestamp(d), year(d), month(d), day(d), dayofmonth(d),
     weekofyear(d), to_date(d)
   from date_udf
 PREHOOK: type: QUERY
 PREHOOK: Input: default@date_udf
 #### A masked pattern was here ####
-POSTHOOK: query: select unix_timestamp(d), year(d), month(d), day(d), dayofmonth(d),
+POSTHOOK: query: select unix_timestamp(cast(d as timestamp with local time zone)), unix_timestamp(d), year(d), month(d), day(d), dayofmonth(d),
     weekofyear(d), to_date(d)
   from date_udf
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@date_udf
 #### A masked pattern was here ####
-1304665200	2011	5	6	6	18	2011-05-06
+1304665200	1304640000	2011	5	6	6	18	2011-05-06
 PREHOOK: query: select date_add(d, 5), date_sub(d, 10)
   from date_udf
 PREHOOK: type: QUERY