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

[25/33] hive git commit: HIVE-12192 : Hive should carry out timestamp computations in UTC (Jesus Camacho Rodriguez via Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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/b8fda81c/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 5923209..731129c 100644
--- a/ql/src/test/results/clientpositive/cast_on_constant.q.out
+++ b/ql/src/test/results/clientpositive/cast_on_constant.q.out
@@ -22,10 +22,10 @@ STAGE PLANS:
             alias: t1_n138
             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,10 +96,10 @@ STAGE PLANS:
             alias: t1_n138
             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/b8fda81c/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/b8fda81c/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/b8fda81c/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

http://git-wip-us.apache.org/repos/asf/hive/blob/b8fda81c/ql/src/test/results/clientpositive/decimal_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_1.q.out b/ql/src/test/results/clientpositive/decimal_1.q.out
index f5c92f3..ed61abe 100644
--- a/ql/src/test/results/clientpositive/decimal_1.q.out
+++ b/ql/src/test/results/clientpositive/decimal_1.q.out
@@ -120,7 +120,7 @@ POSTHOOK: query: select cast(t as timestamp) from decimal_1_n0
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_1_n0
 #### A masked pattern was here ####
-1969-12-31 16:00:17.29
+1970-01-01 00:00:17.29
 PREHOOK: query: drop table decimal_1_n0
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@decimal_1_n0

http://git-wip-us.apache.org/repos/asf/hive/blob/b8fda81c/ql/src/test/results/clientpositive/decimal_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/decimal_2.q.out b/ql/src/test/results/clientpositive/decimal_2.q.out
index 56e08d7..22f4c33 100644
--- a/ql/src/test/results/clientpositive/decimal_2.q.out
+++ b/ql/src/test/results/clientpositive/decimal_2.q.out
@@ -210,7 +210,7 @@ POSTHOOK: query: select cast(cast('2012-12-19 11:12:19.1234567' as timestamp) as
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_2_n1
 #### A masked pattern was here ####
-1355944339.1234567
+1355915539.1234567
 PREHOOK: query: select cast(true as decimal) from decimal_2_n1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_2_n1

http://git-wip-us.apache.org/repos/asf/hive/blob/b8fda81c/ql/src/test/results/clientpositive/druid/druid_timestamptz2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/druid/druid_timestamptz2.q.out b/ql/src/test/results/clientpositive/druid/druid_timestamptz2.q.out
new file mode 100644
index 0000000..c71a435
--- /dev/null
+++ b/ql/src/test/results/clientpositive/druid/druid_timestamptz2.q.out
@@ -0,0 +1,308 @@
+PREHOOK: query: CREATE database druid_test_dst
+PREHOOK: type: CREATEDATABASE
+PREHOOK: Output: database:druid_test_dst
+POSTHOOK: query: CREATE database druid_test_dst
+POSTHOOK: type: CREATEDATABASE
+POSTHOOK: Output: database:druid_test_dst
+PREHOOK: query: use druid_test_dst
+PREHOOK: type: SWITCHDATABASE
+PREHOOK: Input: database:druid_test_dst
+POSTHOOK: query: use druid_test_dst
+POSTHOOK: type: SWITCHDATABASE
+POSTHOOK: Input: database:druid_test_dst
+PREHOOK: query: create table test_base_table(`timecolumn` timestamp, `interval_marker` string, `num_l` double)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:druid_test_dst
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: create table test_base_table(`timecolumn` timestamp, `interval_marker` string, `num_l` double)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:druid_test_dst
+POSTHOOK: Output: druid_test_dst@test_base_table
+PREHOOK: query: insert into test_base_table values ('2015-03-08 00:00:00', 'i1-start', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: insert into test_base_table values ('2015-03-08 00:00:00', 'i1-start', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: Lineage: test_base_table.interval_marker SCRIPT []
+POSTHOOK: Lineage: test_base_table.num_l SCRIPT []
+POSTHOOK: Lineage: test_base_table.timecolumn SCRIPT []
+PREHOOK: query: insert into test_base_table values ('2015-03-08 23:59:59', 'i1-end', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: insert into test_base_table values ('2015-03-08 23:59:59', 'i1-end', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: Lineage: test_base_table.interval_marker SCRIPT []
+POSTHOOK: Lineage: test_base_table.num_l SCRIPT []
+POSTHOOK: Lineage: test_base_table.timecolumn SCRIPT []
+PREHOOK: query: insert into test_base_table values ('2015-03-09 00:00:00', 'i2-start', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: insert into test_base_table values ('2015-03-09 00:00:00', 'i2-start', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: Lineage: test_base_table.interval_marker SCRIPT []
+POSTHOOK: Lineage: test_base_table.num_l SCRIPT []
+POSTHOOK: Lineage: test_base_table.timecolumn SCRIPT []
+PREHOOK: query: insert into test_base_table values ('2015-03-09 23:59:59', 'i2-end', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: insert into test_base_table values ('2015-03-09 23:59:59', 'i2-end', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: Lineage: test_base_table.interval_marker SCRIPT []
+POSTHOOK: Lineage: test_base_table.num_l SCRIPT []
+POSTHOOK: Lineage: test_base_table.timecolumn SCRIPT []
+PREHOOK: query: insert into test_base_table values ('2015-03-10 00:00:00', 'i3-start', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: insert into test_base_table values ('2015-03-10 00:00:00', 'i3-start', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: Lineage: test_base_table.interval_marker SCRIPT []
+POSTHOOK: Lineage: test_base_table.num_l SCRIPT []
+POSTHOOK: Lineage: test_base_table.timecolumn SCRIPT []
+PREHOOK: query: insert into test_base_table values ('2015-03-10 23:59:59', 'i3-end', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: query: insert into test_base_table values ('2015-03-10 23:59:59', 'i3-end', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@test_base_table
+POSTHOOK: Lineage: test_base_table.interval_marker SCRIPT []
+POSTHOOK: Lineage: test_base_table.num_l SCRIPT []
+POSTHOOK: Lineage: test_base_table.timecolumn SCRIPT []
+PREHOOK: query: 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
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: druid_test_dst@test_base_table
+PREHOOK: Output: database:druid_test_dst
+PREHOOK: Output: druid_test_dst@druid_test_table_1
+POSTHOOK: query: 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
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: druid_test_dst@test_base_table
+POSTHOOK: Output: database:druid_test_dst
+POSTHOOK: Output: druid_test_dst@druid_test_table_1
+POSTHOOK: Lineage: druid_test_table_1.__time EXPRESSION [(test_base_table)test_base_table.FieldSchema(name:timecolumn, type:timestamp, comment:null), ]
+POSTHOOK: Lineage: druid_test_table_1.interval_marker SIMPLE [(test_base_table)test_base_table.FieldSchema(name:interval_marker, type:string, comment:null), ]
+POSTHOOK: Lineage: druid_test_table_1.num_l SIMPLE [(test_base_table)test_base_table.FieldSchema(name:num_l, type:double, comment:null), ]
+PREHOOK: query: select * FROM druid_test_table_1
+PREHOOK: type: QUERY
+PREHOOK: Input: druid_test_dst@druid_test_table_1
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: select * FROM druid_test_table_1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: druid_test_dst@druid_test_table_1
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+2015-03-08 00:00:00.0 US/Pacific	i1-start	4.0
+2015-03-08 23:59:59.0 US/Pacific	i1-end	1.0
+2015-03-09 00:00:00.0 US/Pacific	i2-start	4.0
+2015-03-09 23:59:59.0 US/Pacific	i2-end	1.0
+2015-03-10 00:00:00.0 US/Pacific	i3-start	2.0
+2015-03-10 23:59:59.0 US/Pacific	i3-end	2.0
+PREHOOK: query: 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")
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:druid_test_dst
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: 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")
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:druid_test_dst
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: insert into druid_test_table_2 values (cast('2015-03-08 00:00:00' as timestamp with local time zone), 'i1-start', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: insert into druid_test_table_2 values (cast('2015-03-08 00:00:00' as timestamp with local time zone), 'i1-start', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: insert into druid_test_table_2 values (cast('2015-03-08 23:59:59' as timestamp with local time zone), 'i1-end', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: insert into druid_test_table_2 values (cast('2015-03-08 23:59:59' as timestamp with local time zone), 'i1-end', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: insert into druid_test_table_2 values (cast('2015-03-09 00:00:00' as timestamp with local time zone), 'i2-start', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: insert into druid_test_table_2 values (cast('2015-03-09 00:00:00' as timestamp with local time zone), 'i2-start', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: insert into druid_test_table_2 values (cast('2015-03-09 23:59:59' as timestamp with local time zone), 'i2-end', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: insert into druid_test_table_2 values (cast('2015-03-09 23:59:59' as timestamp with local time zone), 'i2-end', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: insert into druid_test_table_2 values (cast('2015-03-10 00:00:00' as timestamp with local time zone), 'i3-start', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: insert into druid_test_table_2 values (cast('2015-03-10 00:00:00' as timestamp with local time zone), 'i3-start', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: insert into druid_test_table_2 values (cast('2015-03-10 23:59:59' as timestamp with local time zone), 'i3-end', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_2
+POSTHOOK: query: insert into druid_test_table_2 values (cast('2015-03-10 23:59:59' as timestamp with local time zone), 'i3-end', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_2
+PREHOOK: query: select * FROM druid_test_table_2
+PREHOOK: type: QUERY
+PREHOOK: Input: druid_test_dst@druid_test_table_2
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: select * FROM druid_test_table_2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: druid_test_dst@druid_test_table_2
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+2015-03-08 00:00:00.0 US/Pacific	i1-start	4.0
+2015-03-08 23:59:59.0 US/Pacific	i1-end	1.0
+2015-03-09 00:00:00.0 US/Pacific	i2-start	4.0
+2015-03-09 23:59:59.0 US/Pacific	i2-end	1.0
+2015-03-10 00:00:00.0 US/Pacific	i3-start	2.0
+2015-03-10 23:59:59.0 US/Pacific	i3-end	2.0
+PREHOOK: query: 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
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: druid_test_dst@test_base_table
+PREHOOK: Output: database:druid_test_dst
+PREHOOK: Output: druid_test_dst@druid_test_table_utc
+POSTHOOK: query: 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
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: druid_test_dst@test_base_table
+POSTHOOK: Output: database:druid_test_dst
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc
+POSTHOOK: Lineage: druid_test_table_utc.__time EXPRESSION [(test_base_table)test_base_table.FieldSchema(name:timecolumn, type:timestamp, comment:null), ]
+POSTHOOK: Lineage: druid_test_table_utc.interval_marker SIMPLE [(test_base_table)test_base_table.FieldSchema(name:interval_marker, type:string, comment:null), ]
+POSTHOOK: Lineage: druid_test_table_utc.num_l SIMPLE [(test_base_table)test_base_table.FieldSchema(name:num_l, type:double, comment:null), ]
+PREHOOK: query: select * FROM druid_test_table_utc
+PREHOOK: type: QUERY
+PREHOOK: Input: druid_test_dst@druid_test_table_utc
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: select * FROM druid_test_table_utc
+POSTHOOK: type: QUERY
+POSTHOOK: Input: druid_test_dst@druid_test_table_utc
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+2015-03-08 00:00:00.0 UTC	i1-start	4.0
+2015-03-08 23:59:59.0 UTC	i1-end	1.0
+2015-03-09 00:00:00.0 UTC	i2-start	4.0
+2015-03-09 23:59:59.0 UTC	i2-end	1.0
+2015-03-10 00:00:00.0 UTC	i3-start	2.0
+2015-03-10 23:59:59.0 UTC	i3-end	2.0
+PREHOOK: query: 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")
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:druid_test_dst
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: 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")
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:druid_test_dst
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-08 00:00:00' as timestamp with local time zone), 'i1-start', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-08 00:00:00' as timestamp with local time zone), 'i1-start', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-08 23:59:59' as timestamp with local time zone), 'i1-end', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-08 23:59:59' as timestamp with local time zone), 'i1-end', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-09 00:00:00' as timestamp with local time zone), 'i2-start', 4)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-09 00:00:00' as timestamp with local time zone), 'i2-start', 4)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-09 23:59:59' as timestamp with local time zone), 'i2-end', 1)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-09 23:59:59' as timestamp with local time zone), 'i2-end', 1)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-10 00:00:00' as timestamp with local time zone), 'i3-start', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-10 00:00:00' as timestamp with local time zone), 'i3-start', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-10 23:59:59' as timestamp with local time zone), 'i3-end', 2)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: druid_test_dst@druid_test_table_utc2
+POSTHOOK: query: insert into druid_test_table_utc2 values (cast('2015-03-10 23:59:59' as timestamp with local time zone), 'i3-end', 2)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: druid_test_dst@druid_test_table_utc2
+PREHOOK: query: select * FROM druid_test_table_utc2
+PREHOOK: type: QUERY
+PREHOOK: Input: druid_test_dst@druid_test_table_utc2
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: select * FROM druid_test_table_utc2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: druid_test_dst@druid_test_table_utc2
+POSTHOOK: Output: hdfs://### HDFS PATH ###
+2015-03-08 00:00:00.0 UTC	i1-start	4.0
+2015-03-08 23:59:59.0 UTC	i1-end	1.0
+2015-03-09 00:00:00.0 UTC	i2-start	4.0
+2015-03-09 23:59:59.0 UTC	i2-end	1.0
+2015-03-10 00:00:00.0 UTC	i3-start	2.0
+2015-03-10 23:59:59.0 UTC	i3-end	2.0

http://git-wip-us.apache.org/repos/asf/hive/blob/b8fda81c/ql/src/test/results/clientpositive/foldts.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/foldts.q.out b/ql/src/test/results/clientpositive/foldts.q.out
index 2a82b9a..83a6481 100644
--- a/ql/src/test/results/clientpositive/foldts.q.out
+++ b/ql/src/test/results/clientpositive/foldts.q.out
@@ -45,7 +45,7 @@ POSTHOOK: query: select ctimestamp1, unix_timestamp(ctimestamp1), to_unix_timest
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-1969-12-31 15:59:46.674	-13	-13
+1969-12-31 15:59:46.674	-28813	-28813
 PREHOOK: query: create temporary table src1orc stored as orc as select * from src1
 PREHOOK: type: CREATETABLE_AS_SELECT
 PREHOOK: Input: default@src1