hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcama...@apache.org
Subject [3/4] hive git commit: HIVE-16614: Support "set local time zone" statement (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)
Date Thu, 24 Aug 2017 21:38:35 GMT
http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/ql/src/test/results/clientpositive/localtimezone.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/localtimezone.q.out b/ql/src/test/results/clientpositive/localtimezone.q.out
new file mode 100644
index 0000000..3bca0b8
--- /dev/null
+++ b/ql/src/test/results/clientpositive/localtimezone.q.out
@@ -0,0 +1,558 @@
+PREHOOK: query: drop table `date_test`
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table `date_test`
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: drop table `timestamp_test`
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table `timestamp_test`
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: drop table `timestamptz_test`
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table `timestamptz_test`
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table `date_test` (`mydate1` date)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@date_test
+POSTHOOK: query: create table `date_test` (`mydate1` date)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@date_test
+PREHOOK: query: 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')
+PREHOOK: type: QUERY
+PREHOOK: Output: default@date_test
+POSTHOOK: query: 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')
+POSTHOOK: type: QUERY
+POSTHOOK: Output: default@date_test
+POSTHOOK: Lineage: date_test.mydate1 EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
+PREHOOK: query: create table `timestamp_test` (`mydate1` timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamp_test
+POSTHOOK: query: create table `timestamp_test` (`mydate1` timestamp)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@timestamp_test
+PREHOOK: query: 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')
+PREHOOK: type: QUERY
+PREHOOK: Output: default@timestamp_test
+POSTHOOK: query: 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')
+POSTHOOK: type: QUERY
+POSTHOOK: Output: default@timestamp_test
+POSTHOOK: Lineage: timestamp_test.mydate1 EXPRESSION [(values__tmp__table__2)values__tmp__table__2.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
+PREHOOK: query: create table `timestamptz_test` (`mydate1` timestamp with local time zone)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamptz_test
+POSTHOOK: query: create table `timestamptz_test` (`mydate1` timestamp with local time zone)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@timestamptz_test
+PREHOOK: query: 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')
+PREHOOK: type: QUERY
+PREHOOK: Output: default@timestamptz_test
+POSTHOOK: query: 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')
+POSTHOOK: type: QUERY
+POSTHOOK: Output: default@timestamptz_test
+POSTHOOK: Lineage: timestamptz_test.mydate1 EXPRESSION [(values__tmp__table__3)values__tmp__table__3.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
+PREHOOK: query: select * from `date_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@date_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `date_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@date_test
+#### A masked pattern was here ####
+2011-01-01
+2010-12-31
+2010-12-31
+2011-01-01
+2010-12-31
+2010-12-31
+NULL
+PREHOOK: query: select * from `timestamp_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamp_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123
+2010-12-31 16:01:01.123
+2010-12-31 22:01:01.123
+2011-01-01 01:01:01.123456789
+2010-12-31 16:01:01.123456789
+2010-12-31 22:01:01.123456789
+NULL
+PREHOOK: query: select * from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123 US/Pacific
+2010-12-31 16:01:01.123 US/Pacific
+2010-12-31 22:01:01.123 US/Pacific
+2011-01-01 01:01:01.123456789 US/Pacific
+2010-12-31 16:01:01.123456789 US/Pacific
+2010-12-31 22:01:01.123456789 US/Pacific
+NULL
+PREHOOK: query: select * from `date_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@date_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `date_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@date_test
+#### A masked pattern was here ####
+2011-01-01
+2010-12-31
+2010-12-31
+2011-01-01
+2010-12-31
+2010-12-31
+NULL
+PREHOOK: query: select * from `timestamp_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamp_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123
+2010-12-31 16:01:01.123
+2010-12-31 22:01:01.123
+2011-01-01 01:01:01.123456789
+2010-12-31 16:01:01.123456789
+2010-12-31 22:01:01.123456789
+NULL
+PREHOOK: query: select * from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011-01-01 10:01:01.123 Europe/Rome
+2011-01-01 01:01:01.123 Europe/Rome
+2011-01-01 07:01:01.123 Europe/Rome
+2011-01-01 10:01:01.123456789 Europe/Rome
+2011-01-01 01:01:01.123456789 Europe/Rome
+2011-01-01 07:01:01.123456789 Europe/Rome
+NULL
+PREHOOK: query: select * from `date_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@date_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `date_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@date_test
+#### A masked pattern was here ####
+2011-01-01
+2010-12-31
+2010-12-31
+2011-01-01
+2010-12-31
+2010-12-31
+NULL
+PREHOOK: query: select * from `timestamp_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamp_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123
+2010-12-31 16:01:01.123
+2010-12-31 22:01:01.123
+2011-01-01 01:01:01.123456789
+2010-12-31 16:01:01.123456789
+2010-12-31 22:01:01.123456789
+NULL
+PREHOOK: query: select * from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123 America/Los_Angeles
+2010-12-31 16:01:01.123 America/Los_Angeles
+2010-12-31 22:01:01.123 America/Los_Angeles
+2011-01-01 01:01:01.123456789 America/Los_Angeles
+2010-12-31 16:01:01.123456789 America/Los_Angeles
+2010-12-31 22:01:01.123456789 America/Los_Angeles
+NULL
+PREHOOK: query: select * from `date_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@date_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `date_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@date_test
+#### A masked pattern was here ####
+2011-01-01
+2010-12-31
+2010-12-31
+2011-01-01
+2010-12-31
+2010-12-31
+NULL
+PREHOOK: query: select * from `timestamp_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamp_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123
+2010-12-31 16:01:01.123
+2010-12-31 22:01:01.123
+2011-01-01 01:01:01.123456789
+2010-12-31 16:01:01.123456789
+2010-12-31 22:01:01.123456789
+NULL
+PREHOOK: query: select * from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select * from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011-01-01 02:01:01.123 GMT-07:00
+2010-12-31 17:01:01.123 GMT-07:00
+2010-12-31 23:01:01.123 GMT-07:00
+2011-01-01 02:01:01.123456789 GMT-07:00
+2010-12-31 17:01:01.123456789 GMT-07:00
+2010-12-31 23:01:01.123456789 GMT-07:00
+NULL
+PREHOOK: query: select extract(year from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(year from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011
+2010
+2010
+2011
+2010
+2010
+NULL
+PREHOOK: query: select extract(quarter from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(quarter from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+1
+4
+4
+1
+4
+4
+NULL
+PREHOOK: query: select extract(month from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(month from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+1
+12
+12
+1
+12
+12
+NULL
+PREHOOK: query: select extract(day from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(day from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+1
+31
+31
+1
+31
+31
+NULL
+PREHOOK: query: select extract(hour from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(hour from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2
+17
+23
+2
+17
+23
+NULL
+PREHOOK: query: select extract(minute from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(minute from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+1
+1
+1
+1
+1
+1
+NULL
+PREHOOK: query: select extract(second from `mydate1`) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select extract(second from `mydate1`) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+1
+1
+1
+1
+1
+1
+NULL
+PREHOOK: query: select cast(`mydate1` as date) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select cast(`mydate1` as date) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011-01-01
+2010-12-31
+2010-12-31
+2011-01-01
+2010-12-31
+2010-12-31
+NULL
+PREHOOK: query: select cast(`mydate1` as timestamp with local time zone) from `date_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@date_test
+#### A masked pattern was here ####
+POSTHOOK: query: select cast(`mydate1` as timestamp with local time zone) from `date_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@date_test
+#### A masked pattern was here ####
+2011-01-01 00:00:00.0 GMT-07:00
+2010-12-31 00:00:00.0 GMT-07:00
+2010-12-31 00:00:00.0 GMT-07:00
+2011-01-01 00:00:00.0 GMT-07:00
+2010-12-31 00:00:00.0 GMT-07:00
+2010-12-31 00:00:00.0 GMT-07:00
+NULL
+PREHOOK: query: select cast(`mydate1` as timestamp) from `timestamptz_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select cast(`mydate1` as timestamp) from `timestamptz_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2011-01-01 02:01:01.123
+2010-12-31 17:01:01.123
+2010-12-31 23:01:01.123
+2011-01-01 02:01:01.123456789
+2010-12-31 17:01:01.123456789
+2010-12-31 23:01:01.123456789
+NULL
+PREHOOK: query: select cast(`mydate1` as timestamp with local time zone) from `timestamp_test`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+POSTHOOK: query: select cast(`mydate1` as timestamp with local time zone) from `timestamp_test`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamp_test
+#### A masked pattern was here ####
+2011-01-01 01:01:01.123 GMT-07:00
+2010-12-31 16:01:01.123 GMT-07:00
+2010-12-31 22:01:01.123 GMT-07:00
+2011-01-01 01:01:01.123456789 GMT-07:00
+2010-12-31 16:01:01.123456789 GMT-07:00
+2010-12-31 22:01:01.123456789 GMT-07:00
+NULL
+PREHOOK: query: select `mydate1` from `timestamptz_test` group by `mydate1`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select `mydate1` from `timestamptz_test` group by `mydate1`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+NULL
+2010-12-31 17:01:01.123 GMT-07:00
+2010-12-31 17:01:01.123456789 GMT-07:00
+2010-12-31 23:01:01.123 GMT-07:00
+2010-12-31 23:01:01.123456789 GMT-07:00
+2011-01-01 02:01:01.123 GMT-07:00
+2011-01-01 02:01:01.123456789 GMT-07:00
+PREHOOK: query: select a.`mydate1` as c1, b.`mydate1` as c2
+from `timestamptz_test` a join `timestamptz_test` b
+on a.`mydate1` = b.`mydate1`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+POSTHOOK: query: select a.`mydate1` as c1, b.`mydate1` as c2
+from `timestamptz_test` a join `timestamptz_test` b
+on a.`mydate1` = b.`mydate1`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test
+#### A masked pattern was here ####
+2010-12-31 17:01:01.123 GMT-07:00	2010-12-31 17:01:01.123 GMT-07:00
+2010-12-31 17:01:01.123456789 GMT-07:00	2010-12-31 17:01:01.123456789 GMT-07:00
+2010-12-31 23:01:01.123 GMT-07:00	2010-12-31 23:01:01.123 GMT-07:00
+2010-12-31 23:01:01.123456789 GMT-07:00	2010-12-31 23:01:01.123456789 GMT-07:00
+2011-01-01 02:01:01.123 GMT-07:00	2011-01-01 02:01:01.123 GMT-07:00
+2011-01-01 02:01:01.123456789 GMT-07:00	2011-01-01 02:01:01.123456789 GMT-07:00
+PREHOOK: query: create table `timestamptz_test2` (`mydate1` timestamp with local time zone, `item` string, `price` double)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamptz_test2
+POSTHOOK: query: create table `timestamptz_test2` (`mydate1` timestamp with local time zone, `item` string, `price` double)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@timestamptz_test2
+PREHOOK: query: insert into `timestamptz_test2` VALUES
+  ('2011-01-01 01:01:01.123', 'laptop 1', 9.2),
+  ('2011-01-01 01:01:01.123', 'mouse 1', 3.1),
+  ('2011-01-01 01:01:01.123 Europe/Rome', 'keyboard 1', 4.2),
+  ('2011-01-01 01:01:01.123 GMT-05:00', 'keyboard 2', 3.9),
+  ('2011-01-01 01:01:01.123 GMT-05:00', 'keyboard 3', 3.99),
+  ('2011-01-01 01:01:01.12345678912', 'mouse 2', 4.594),
+  ('2011-01-01 01:01:01.12345678912 Europe/Rome', 'laptop 2', 10),
+  ('2011-01-01 01:01:01.12345678912 Europe/Rome', 'hdmi', 1.25),
+  ('2011-01-01 01:01:01.12345678912 GMT-05:00', 'pin', null),
+  ('2011-01-01 01:01:01.12345678912 xyz', 'cable', 0.0)
+PREHOOK: type: QUERY
+PREHOOK: Output: default@timestamptz_test2
+POSTHOOK: query: insert into `timestamptz_test2` VALUES
+  ('2011-01-01 01:01:01.123', 'laptop 1', 9.2),
+  ('2011-01-01 01:01:01.123', 'mouse 1', 3.1),
+  ('2011-01-01 01:01:01.123 Europe/Rome', 'keyboard 1', 4.2),
+  ('2011-01-01 01:01:01.123 GMT-05:00', 'keyboard 2', 3.9),
+  ('2011-01-01 01:01:01.123 GMT-05:00', 'keyboard 3', 3.99),
+  ('2011-01-01 01:01:01.12345678912', 'mouse 2', 4.594),
+  ('2011-01-01 01:01:01.12345678912 Europe/Rome', 'laptop 2', 10),
+  ('2011-01-01 01:01:01.12345678912 Europe/Rome', 'hdmi', 1.25),
+  ('2011-01-01 01:01:01.12345678912 GMT-05:00', 'pin', null),
+  ('2011-01-01 01:01:01.12345678912 xyz', 'cable', 0.0)
+POSTHOOK: type: QUERY
+POSTHOOK: Output: default@timestamptz_test2
+POSTHOOK: Lineage: timestamptz_test2.item SIMPLE [(values__tmp__table__4)values__tmp__table__4.FieldSchema(name:tmp_values_col2, type:string, comment:), ]
+POSTHOOK: Lineage: timestamptz_test2.mydate1 EXPRESSION [(values__tmp__table__4)values__tmp__table__4.FieldSchema(name:tmp_values_col1, type:string, comment:), ]
+POSTHOOK: Lineage: timestamptz_test2.price EXPRESSION [(values__tmp__table__4)values__tmp__table__4.FieldSchema(name:tmp_values_col3, type:string, comment:), ]
+PREHOOK: query: select `item`, `price`,
+rank() over (partition by `mydate1` order by `price`) as r
+from `timestamptz_test2`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test2
+#### A masked pattern was here ####
+POSTHOOK: query: select `item`, `price`,
+rank() over (partition by `mydate1` order by `price`) as r
+from `timestamptz_test2`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test2
+#### A masked pattern was here ####
+cable	0.0	1
+keyboard 1	4.2	1
+hdmi	1.25	1
+laptop 2	10.0	2
+keyboard 2	3.9	1
+keyboard 3	3.99	2
+pin	NULL	1
+mouse 1	3.1	1
+laptop 1	9.2	2
+mouse 2	4.594	1
+PREHOOK: query: select `item`, `price`,
+rank() over (partition by cast(`mydate1` as date) order by `price`) as r
+from `timestamptz_test2`
+PREHOOK: type: QUERY
+PREHOOK: Input: default@timestamptz_test2
+#### A masked pattern was here ####
+POSTHOOK: query: select `item`, `price`,
+rank() over (partition by cast(`mydate1` as date) order by `price`) as r
+from `timestamptz_test2`
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@timestamptz_test2
+#### A masked pattern was here ####
+cable	0.0	1
+pin	NULL	1
+hdmi	1.25	2
+keyboard 2	3.9	3
+keyboard 3	3.99	4
+keyboard 1	4.2	5
+laptop 2	10.0	6
+mouse 1	3.1	1
+mouse 2	4.594	2
+laptop 1	9.2	3

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/ql/src/test/results/clientpositive/timestamptz.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/timestamptz.q.out b/ql/src/test/results/clientpositive/timestamptz.q.out
index 626fe92..31d2e71 100644
--- a/ql/src/test/results/clientpositive/timestamptz.q.out
+++ b/ql/src/test/results/clientpositive/timestamptz.q.out
@@ -1,6 +1,6 @@
-PREHOOK: query: explain select cast('2005-01-03 02:01:00 GMT' as timestamp with time zone)
+PREHOOK: query: explain select cast('2005-01-03 02:01:00 GMT' as timestamp with local time zone)
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select cast('2005-01-03 02:01:00 GMT' as timestamp with time zone)
+POSTHOOK: query: explain select cast('2005-01-03 02:01:00 GMT' as timestamp with local time zone)
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
@@ -15,23 +15,23 @@ STAGE PLANS:
           Row Limit Per Split: 1
           Statistics: Num rows: 1 Data size: 1 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: 2005-01-03 02:01:00.0 Z (type: timestamp with time zone)
+            expressions: 2005-01-02 18:01:00.0 US/Pacific (type: timestamp with local time zone)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink
 
-PREHOOK: query: select cast('2005-01-03 02:01:00 GMT' as timestamp with time zone)
+PREHOOK: query: select cast('2005-01-03 02:01:00 GMT' as timestamp with local time zone)
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-POSTHOOK: query: select cast('2005-01-03 02:01:00 GMT' as timestamp with time zone)
+POSTHOOK: query: select cast('2005-01-03 02:01:00 GMT' as timestamp with local time zone)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-2005-01-03 02:01:00.0 Z
-PREHOOK: query: explain select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamptz)
+2005-01-02 18:01:00.0 US/Pacific
+PREHOOK: query: explain select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamplocaltz)
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamptz)
+POSTHOOK: query: explain select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamplocaltz)
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
@@ -46,23 +46,23 @@ STAGE PLANS:
           Row Limit Per Split: 1
           Statistics: Num rows: 1 Data size: 1 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: 2016-01-03 20:26:34.0123 Z (type: timestamp with time zone)
+            expressions: 2016-01-03 12:26:34.0123 US/Pacific (type: timestamp with local time zone)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink
 
-PREHOOK: query: select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamptz)
+PREHOOK: query: select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamplocaltz)
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-POSTHOOK: query: select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamptz)
+POSTHOOK: query: select cast('2016-01-03 12:26:34.0123 America/Los_Angeles' as timestamplocaltz)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-2016-01-03 20:26:34.0123 Z
-PREHOOK: query: explain select cast('2016-01-03Europe/London' as timestamptz)
+2016-01-03 12:26:34.0123 US/Pacific
+PREHOOK: query: explain select cast('2016-01-03Europe/London' as timestamplocaltz)
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select cast('2016-01-03Europe/London' as timestamptz)
+POSTHOOK: query: explain select cast('2016-01-03Europe/London' as timestamplocaltz)
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
@@ -77,23 +77,23 @@ STAGE PLANS:
           Row Limit Per Split: 1
           Statistics: Num rows: 1 Data size: 1 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: 2016-01-03 00:00:00.0 Z (type: timestamp with time zone)
+            expressions: 2016-01-02 16:00:00.0 US/Pacific (type: timestamp with local time zone)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink
 
-PREHOOK: query: select cast('2016-01-03Europe/London' as timestamptz)
+PREHOOK: query: select cast('2016-01-03Europe/London' as timestamplocaltz)
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-POSTHOOK: query: select cast('2016-01-03Europe/London' as timestamptz)
+POSTHOOK: query: select cast('2016-01-03Europe/London' as timestamplocaltz)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-2016-01-03 00:00:00.0 Z
-PREHOOK: query: explain select cast('2016-01-03 13:34:56.38 +1:00' as timestamptz)
+2016-01-02 16:00:00.0 US/Pacific
+PREHOOK: query: explain select cast('2016-01-03 13:34:56.38 +1:00' as timestamplocaltz)
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select cast('2016-01-03 13:34:56.38 +1:00' as timestamptz)
+POSTHOOK: query: explain select cast('2016-01-03 13:34:56.38 +1:00' as timestamplocaltz)
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-0 is a root stage
@@ -108,17 +108,17 @@ STAGE PLANS:
           Row Limit Per Split: 1
           Statistics: Num rows: 1 Data size: 1 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: 2016-01-03 12:34:56.38 Z (type: timestamp with time zone)
+            expressions: 2016-01-03 04:34:56.38 US/Pacific (type: timestamp with local time zone)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             ListSink
 
-PREHOOK: query: select cast('2016-01-03 13:34:56.38 +1:00' as timestamptz)
+PREHOOK: query: select cast('2016-01-03 13:34:56.38 +1:00' as timestamplocaltz)
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-POSTHOOK: query: select cast('2016-01-03 13:34:56.38 +1:00' as timestamptz)
+POSTHOOK: query: select cast('2016-01-03 13:34:56.38 +1:00' as timestamplocaltz)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
-2016-01-03 12:34:56.38 Z
+2016-01-03 04:34:56.38 US/Pacific

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/ql/src/test/results/clientpositive/timestamptz_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/timestamptz_1.q.out b/ql/src/test/results/clientpositive/timestamptz_1.q.out
index 75bbfac..4756033 100644
--- a/ql/src/test/results/clientpositive/timestamptz_1.q.out
+++ b/ql/src/test/results/clientpositive/timestamptz_1.q.out
@@ -2,19 +2,19 @@ PREHOOK: query: drop table tstz1
 PREHOOK: type: DROPTABLE
 POSTHOOK: query: drop table tstz1
 POSTHOOK: type: DROPTABLE
-PREHOOK: query: create table tstz1(t timestamp with time zone)
+PREHOOK: query: create table tstz1(t timestamp with local time zone)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@tstz1
-POSTHOOK: query: create table tstz1(t timestamp with time zone)
+POSTHOOK: query: create table tstz1(t timestamp with local time zone)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@tstz1
-PREHOOK: query: insert overwrite table tstz1 select cast('2016-01-03 12:26:34 America/Los_Angeles' as timestamp with time zone)
+PREHOOK: query: insert overwrite table tstz1 select cast('2016-01-03 12:26:34 America/Los_Angeles' as timestamp with local time zone)
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
 PREHOOK: Output: default@tstz1
-POSTHOOK: query: insert overwrite table tstz1 select cast('2016-01-03 12:26:34 America/Los_Angeles' as timestamp with time zone)
+POSTHOOK: query: insert overwrite table tstz1 select cast('2016-01-03 12:26:34 America/Los_Angeles' as timestamp with local time zone)
 POSTHOOK: type: QUERY
 POSTHOOK: Input: _dummy_database@_dummy_table
 POSTHOOK: Output: default@tstz1
@@ -27,7 +27,7 @@ POSTHOOK: query: select cast(t as string) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 20:26:34.0 Z
+2016-01-03 12:26:34.0 US/Pacific
 PREHOOK: query: select cast(t as date) from tstz1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz1
@@ -45,7 +45,7 @@ POSTHOOK: query: select cast(t as timestamp) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 20:26:34
+2016-01-03 12:26:34
 PREHOOK: query: insert overwrite table tstz1 select '2016-01-03 12:26:34.1 GMT'
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
@@ -63,7 +63,7 @@ POSTHOOK: query: select cast(t as string) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 12:26:34.1 Z
+2016-01-03 04:26:34.1 US/Pacific
 PREHOOK: query: select cast(t as date) from tstz1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz1
@@ -81,7 +81,7 @@ POSTHOOK: query: select cast(t as timestamp) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 12:26:34.1
+2016-01-03 04:26:34.1
 PREHOOK: query: insert overwrite table tstz1 select '2016-01-03 12:26:34.0123 Europe/London'
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
@@ -99,7 +99,7 @@ POSTHOOK: query: select cast(t as string) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 12:26:34.0123 Z
+2016-01-03 04:26:34.0123 US/Pacific
 PREHOOK: query: select cast(t as date) from tstz1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz1
@@ -117,7 +117,7 @@ POSTHOOK: query: select cast(t as timestamp) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 12:26:34.0123
+2016-01-03 04:26:34.0123
 PREHOOK: query: insert overwrite table tstz1 select '2016-01-03 12:26:34.012300 GMT+08:00'
 PREHOOK: type: QUERY
 PREHOOK: Input: _dummy_database@_dummy_table
@@ -135,7 +135,7 @@ POSTHOOK: query: select cast(t as string) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 04:26:34.0123 Z
+2016-01-02 20:26:34.0123 US/Pacific
 PREHOOK: query: select cast(t as date) from tstz1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz1
@@ -144,7 +144,7 @@ POSTHOOK: query: select cast(t as date) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03
+2016-01-02
 PREHOOK: query: select cast(t as timestamp) from tstz1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz1
@@ -153,4 +153,4 @@ POSTHOOK: query: select cast(t as timestamp) from tstz1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz1
 #### A masked pattern was here ####
-2016-01-03 04:26:34.0123
+2016-01-02 20:26:34.0123

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/ql/src/test/results/clientpositive/timestamptz_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/timestamptz_2.q.out b/ql/src/test/results/clientpositive/timestamptz_2.q.out
index 2666735..8c92f63 100644
--- a/ql/src/test/results/clientpositive/timestamptz_2.q.out
+++ b/ql/src/test/results/clientpositive/timestamptz_2.q.out
@@ -2,11 +2,11 @@ PREHOOK: query: drop table tstz2
 PREHOOK: type: DROPTABLE
 POSTHOOK: query: drop table tstz2
 POSTHOOK: type: DROPTABLE
-PREHOOK: query: create table tstz2(t timestamp with time zone)
+PREHOOK: query: create table tstz2(t timestamp with local time zone)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@tstz2
-POSTHOOK: query: create table tstz2(t timestamp with time zone)
+POSTHOOK: query: create table tstz2(t timestamp with local time zone)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@tstz2
@@ -29,8 +29,8 @@ POSTHOOK: query: select * from tstz2 where t='2005-01-02 19:01:00 GMT-07:00'
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz2
 #### A masked pattern was here ####
-2005-01-03 02:01:00.0 Z
-2005-01-03 02:01:00.0 Z
+2005-01-03 02:01:00.0 UTC
+2005-01-03 02:01:00.0 UTC
 PREHOOK: query: select * from tstz2 where t>'2013-06-03 02:01:00.30547 GMT+01:00'
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz2
@@ -39,7 +39,7 @@ POSTHOOK: query: select * from tstz2 where t>'2013-06-03 02:01:00.30547 GMT+01:0
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz2
 #### A masked pattern was here ####
-2016-01-03 04:26:34.0123 Z
+2016-01-03 04:26:34.0123 UTC
 PREHOOK: query: select min(t),max(t) from tstz2
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz2
@@ -48,7 +48,7 @@ POSTHOOK: query: select min(t),max(t) from tstz2
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz2
 #### A masked pattern was here ####
-2005-01-03 02:01:00.0 Z	2016-01-03 04:26:34.0123 Z
+2005-01-03 02:01:00.0 UTC	2016-01-03 04:26:34.0123 UTC
 PREHOOK: query: select t from tstz2 group by t order by t
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz2
@@ -57,10 +57,10 @@ POSTHOOK: query: select t from tstz2 group by t order by t
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz2
 #### A masked pattern was here ####
-2005-01-03 02:01:00.0 Z
-2005-04-03 10:01:00.04067 Z
-2013-06-03 01:01:00.30547 Z
-2016-01-03 04:26:34.0123 Z
+2005-01-03 02:01:00.0 UTC
+2005-04-03 10:01:00.04067 UTC
+2013-06-03 01:01:00.30547 UTC
+2016-01-03 04:26:34.0123 UTC
 PREHOOK: query: select * from tstz2 a join tstz2 b on a.t=b.t order by a.t
 PREHOOK: type: QUERY
 PREHOOK: Input: default@tstz2
@@ -69,10 +69,10 @@ POSTHOOK: query: select * from tstz2 a join tstz2 b on a.t=b.t order by a.t
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@tstz2
 #### A masked pattern was here ####
-2005-01-03 02:01:00.0 Z	2005-01-03 02:01:00.0 Z
-2005-01-03 02:01:00.0 Z	2005-01-03 02:01:00.0 Z
-2005-01-03 02:01:00.0 Z	2005-01-03 02:01:00.0 Z
-2005-01-03 02:01:00.0 Z	2005-01-03 02:01:00.0 Z
-2005-04-03 10:01:00.04067 Z	2005-04-03 10:01:00.04067 Z
-2013-06-03 01:01:00.30547 Z	2013-06-03 01:01:00.30547 Z
-2016-01-03 04:26:34.0123 Z	2016-01-03 04:26:34.0123 Z
+2005-01-03 02:01:00.0 UTC	2005-01-03 02:01:00.0 UTC
+2005-01-03 02:01:00.0 UTC	2005-01-03 02:01:00.0 UTC
+2005-01-03 02:01:00.0 UTC	2005-01-03 02:01:00.0 UTC
+2005-01-03 02:01:00.0 UTC	2005-01-03 02:01:00.0 UTC
+2005-04-03 10:01:00.04067 UTC	2005-04-03 10:01:00.04067 UTC
+2013-06-03 01:01:00.30547 UTC	2013-06-03 01:01:00.30547 UTC
+2016-01-03 04:26:34.0123 UTC	2016-01-03 04:26:34.0123 UTC

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/if/serde.thrift
----------------------------------------------------------------------
diff --git a/serde/if/serde.thrift b/serde/if/serde.thrift
index c331242..cbdd604 100644
--- a/serde/if/serde.thrift
+++ b/serde/if/serde.thrift
@@ -64,7 +64,7 @@ const string DECIMAL_TYPE_NAME   = "decimal";
 const string BINARY_TYPE_NAME    = "binary";
 const string INTERVAL_YEAR_MONTH_TYPE_NAME = "interval_year_month";
 const string INTERVAL_DAY_TIME_TYPE_NAME   = "interval_day_time";
-const string TIMESTAMPTZ_TYPE_NAME = "timestamp with time zone";
+const string TIMESTAMPLOCALTZ_TYPE_NAME = "timestamp with local time zone";
 
 const string LIST_TYPE_NAME = "array";
 const string MAP_TYPE_NAME  = "map";
@@ -96,7 +96,7 @@ const set<string> PrimitiveTypes  = [
   INTERVAL_DAY_TIME_TYPE_NAME
   DECIMAL_TYPE_NAME
   BINARY_TYPE_NAME
-  TIMESTAMPTZ_TYPE_NAME
+  TIMESTAMPLOCALTZ_TYPE_NAME
 ],
 
 const set<string> CollectionTypes = [ LIST_TYPE_NAME MAP_TYPE_NAME ],

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/gen/thrift/gen-cpp/serde_constants.cpp
----------------------------------------------------------------------
diff --git a/serde/src/gen/thrift/gen-cpp/serde_constants.cpp b/serde/src/gen/thrift/gen-cpp/serde_constants.cpp
index 5674b5e..88cb4ee 100644
--- a/serde/src/gen/thrift/gen-cpp/serde_constants.cpp
+++ b/serde/src/gen/thrift/gen-cpp/serde_constants.cpp
@@ -85,7 +85,7 @@ serdeConstants::serdeConstants() {
 
   INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time";
 
-  TIMESTAMPTZ_TYPE_NAME = "timestamp with time zone";
+  TIMESTAMPLOCALTZ_TYPE_NAME = "timestamp with local time zone";
 
   LIST_TYPE_NAME = "array";
 
@@ -121,7 +121,7 @@ serdeConstants::serdeConstants() {
   PrimitiveTypes.insert("interval_day_time");
   PrimitiveTypes.insert("decimal");
   PrimitiveTypes.insert("binary");
-  PrimitiveTypes.insert("timestamp with time zone");
+  PrimitiveTypes.insert("timestamp with local time zone");
 
   CollectionTypes.insert("array");
   CollectionTypes.insert("map");

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/gen/thrift/gen-cpp/serde_constants.h
----------------------------------------------------------------------
diff --git a/serde/src/gen/thrift/gen-cpp/serde_constants.h b/serde/src/gen/thrift/gen-cpp/serde_constants.h
index e261ed3..12b04b3 100644
--- a/serde/src/gen/thrift/gen-cpp/serde_constants.h
+++ b/serde/src/gen/thrift/gen-cpp/serde_constants.h
@@ -52,7 +52,7 @@ class serdeConstants {
   std::string BINARY_TYPE_NAME;
   std::string INTERVAL_YEAR_MONTH_TYPE_NAME;
   std::string INTERVAL_DAY_TIME_TYPE_NAME;
-  std::string TIMESTAMPTZ_TYPE_NAME;
+  std::string TIMESTAMPLOCALTZ_TYPE_NAME;
   std::string LIST_TYPE_NAME;
   std::string MAP_TYPE_NAME;
   std::string STRUCT_TYPE_NAME;

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java
----------------------------------------------------------------------
diff --git a/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java b/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java
index 4da1d3b..62877f9 100644
--- a/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java
+++ b/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java
@@ -110,7 +110,7 @@ public class serdeConstants {
 
   public static final String INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time";
 
-  public static final String TIMESTAMPTZ_TYPE_NAME = "timestamp with time zone";
+  public static final String TIMESTAMPLOCALTZ_TYPE_NAME = "timestamp with local time zone";
 
   public static final String LIST_TYPE_NAME = "array";
 
@@ -148,7 +148,7 @@ public class serdeConstants {
     PrimitiveTypes.add("interval_day_time");
     PrimitiveTypes.add("decimal");
     PrimitiveTypes.add("binary");
-    PrimitiveTypes.add("timestamp with time zone");
+    PrimitiveTypes.add("timestamp with local time zone");
   }
 
   public static final Set<String> CollectionTypes = new HashSet<String>();

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php
----------------------------------------------------------------------
diff --git a/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php b/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php
index 1a2e8d7..fe32003 100644
--- a/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php
+++ b/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php
@@ -55,7 +55,7 @@ final class Constant extends \Thrift\Type\TConstant {
   static protected $BINARY_TYPE_NAME;
   static protected $INTERVAL_YEAR_MONTH_TYPE_NAME;
   static protected $INTERVAL_DAY_TIME_TYPE_NAME;
-  static protected $TIMESTAMPTZ_TYPE_NAME;
+  static protected $TIMESTAMPLOCALTZ_TYPE_NAME;
   static protected $LIST_TYPE_NAME;
   static protected $MAP_TYPE_NAME;
   static protected $STRUCT_TYPE_NAME;
@@ -216,8 +216,8 @@ final class Constant extends \Thrift\Type\TConstant {
     return "interval_day_time";
   }
 
-  static protected function init_TIMESTAMPTZ_TYPE_NAME() {
-    return "timestamp with time zone";
+  static protected function init_TIMESTAMPLOCALTZ_TYPE_NAME() {
+    return "timestamp with local time zone";
   }
 
   static protected function init_LIST_TYPE_NAME() {
@@ -272,7 +272,7 @@ final class Constant extends \Thrift\Type\TConstant {
       "interval_day_time" => true,
       "decimal" => true,
       "binary" => true,
-      "timestamp with time zone" => true,
+      "timestamp with local time zone" => true,
     );
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py
----------------------------------------------------------------------
diff --git a/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py b/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py
index 79ff525..1e5c919 100644
--- a/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py
+++ b/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py
@@ -46,7 +46,7 @@ DECIMAL_TYPE_NAME = "decimal"
 BINARY_TYPE_NAME = "binary"
 INTERVAL_YEAR_MONTH_TYPE_NAME = "interval_year_month"
 INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time"
-TIMESTAMPTZ_TYPE_NAME = "timestamp with time zone"
+TIMESTAMPLOCALTZ_TYPE_NAME = "timestamp with local time zone"
 LIST_TYPE_NAME = "array"
 MAP_TYPE_NAME = "map"
 STRUCT_TYPE_NAME = "struct"
@@ -74,7 +74,7 @@ PrimitiveTypes = set([
   "interval_day_time",
   "decimal",
   "binary",
-  "timestamp with time zone",
+  "timestamp with local time zone",
 ])
 CollectionTypes = set([
   "array",

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/gen/thrift/gen-rb/serde_constants.rb
----------------------------------------------------------------------
diff --git a/serde/src/gen/thrift/gen-rb/serde_constants.rb b/serde/src/gen/thrift/gen-rb/serde_constants.rb
index 2810324..d6efcbb 100644
--- a/serde/src/gen/thrift/gen-rb/serde_constants.rb
+++ b/serde/src/gen/thrift/gen-rb/serde_constants.rb
@@ -81,7 +81,7 @@ INTERVAL_YEAR_MONTH_TYPE_NAME = %q"interval_year_month"
 
 INTERVAL_DAY_TIME_TYPE_NAME = %q"interval_day_time"
 
-TIMESTAMPTZ_TYPE_NAME = %q"timestamp with time zone"
+TIMESTAMPLOCALTZ_TYPE_NAME = %q"timestamp with local time zone"
 
 LIST_TYPE_NAME = %q"array"
 
@@ -118,7 +118,7 @@ PrimitiveTypes = Set.new([
   %q"interval_day_time",
   %q"decimal",
   %q"binary",
-  %q"timestamp with time zone",
+  %q"timestamp with local time zone",
 ])
 
 CollectionTypes = Set.new([

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java b/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
index b9d23dd..244ff19 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
@@ -49,7 +49,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.primitive.LongObjectInspect
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.ShortObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampTZObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampLocalTZObjectInspector;
 import org.apache.hadoop.io.BytesWritable;
 import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
@@ -277,9 +277,9 @@ public final class SerDeUtils {
           sb.append('"');
           break;
         }
-        case TIMESTAMPTZ: {
+        case TIMESTAMPLOCALTZ: {
           sb.append('"');
-          sb.append(((TimestampTZObjectInspector) poi).getPrimitiveWritableObject(o));
+          sb.append(((TimestampLocalTZObjectInspector) poi).getPrimitiveWritableObject(o));
           sb.append('"');
           break;
         }

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java b/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
index f333ae9..6bfe8a9 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
@@ -51,7 +51,7 @@ 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.TimestampTZWritable;
+import org.apache.hadoop.hive.serde2.io.TimestampLocalTZWritable;
 import org.apache.hadoop.hive.serde2.io.TimestampWritable;
 import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.MapObjectInspector;
@@ -77,12 +77,13 @@ import org.apache.hadoop.hive.serde2.objectinspector.primitive.LongObjectInspect
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.ShortObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampTZObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.TimestampLocalTZObjectInspector;
 import org.apache.hadoop.hive.serde2.typeinfo.BaseCharTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.ListTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.MapTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.TimestampLocalTZTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
@@ -422,14 +423,16 @@ public class BinarySortableSerDe extends AbstractSerDe {
         }
         t.setBinarySortable(bytes, 0);
         return t;
-      case TIMESTAMPTZ:
-        TimestampTZWritable tstz = (reuse == null ? new TimestampTZWritable() :
-            (TimestampTZWritable) reuse);
-        byte[] data = new byte[TimestampTZWritable.BINARY_SORTABLE_LENGTH];
+      case TIMESTAMPLOCALTZ:
+        TimestampLocalTZWritable tstz = (reuse == null ? new TimestampLocalTZWritable() :
+            (TimestampLocalTZWritable) reuse);
+        byte[] data = new byte[TimestampLocalTZWritable.BINARY_SORTABLE_LENGTH];
         for (int i = 0; i < data.length; i++) {
           data[i] = buffer.read(invert);
         }
-        tstz.fromBinarySortable(data, 0);
+        // Across MR process boundary tz is normalized and stored in type
+        // and is not carried in data for each row.
+        tstz.fromBinarySortable(data, 0, ((TimestampLocalTZTypeInfo) type).timeZone());
         return tstz;
       case INTERVAL_YEAR_MONTH: {
         HiveIntervalYearMonthWritable i = reuse == null ? new HiveIntervalYearMonthWritable()
@@ -798,9 +801,9 @@ public class BinarySortableSerDe extends AbstractSerDe {
         serializeTimestampWritable(buffer, t, invert);
         return;
       }
-      case TIMESTAMPTZ: {
-        TimestampTZObjectInspector toi = (TimestampTZObjectInspector) poi;
-        TimestampTZWritable t = toi.getPrimitiveWritableObject(o);
+      case TIMESTAMPLOCALTZ: {
+        TimestampLocalTZObjectInspector toi = (TimestampLocalTZObjectInspector) poi;
+        TimestampLocalTZWritable t = toi.getPrimitiveWritableObject(o);
         serializeTimestampTZWritable(buffer, t, invert);
         return;
       }
@@ -975,7 +978,7 @@ public class BinarySortableSerDe extends AbstractSerDe {
   }
 
   public static void serializeTimestampTZWritable(
-      ByteStream.Output buffer, TimestampTZWritable t, boolean invert) {
+      ByteStream.Output buffer, TimestampLocalTZWritable t, boolean invert) {
     byte[] data = t.toBinarySortable();
     for (byte b : data) {
       writeByte(buffer, b, invert);

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampLocalTZWritable.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampLocalTZWritable.java b/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampLocalTZWritable.java
new file mode 100644
index 0000000..f0bb0ec
--- /dev/null
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampLocalTZWritable.java
@@ -0,0 +1,449 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.serde2.io;
+
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.hive.common.type.TimestampTZ;
+import org.apache.hadoop.hive.serde2.ByteStream;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
+import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.io.WritableUtils;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.time.ZoneId;
+import java.util.Arrays;
+
+/**
+ * Writable for TimestampTZ. Copied from TimestampWritable.
+ * After we replace {@link java.sql.Timestamp} with {@link java.time.LocalDateTime} for Timestamp,
+ * it'll need a new Writable.
+ * All timestamp with time zone will be serialized as UTC retaining the instant.
+ * E.g. "2017-04-14 18:00:00 Asia/Shanghai" will be converted to
+ * "2017-04-14 10:00:00.0 Z".
+ */
+public class TimestampLocalTZWritable implements WritableComparable<TimestampLocalTZWritable> {
+
+  public static final byte[] nullBytes = {0x0, 0x0, 0x0, 0x0};
+  private static final int DECIMAL_OR_SECOND_VINT_FLAG = 1 << 31;
+  private static final long SEVEN_BYTE_LONG_SIGN_FLIP = 0xff80L << 48; // only need flip the MSB?
+
+  /**
+   * The maximum number of bytes required for a TimestampWritable
+   */
+  public static final int MAX_BYTES = 13;
+
+  public static final int BINARY_SORTABLE_LENGTH = 11;
+
+  private TimestampTZ timestampTZ = new TimestampTZ();
+  private ZoneId timeZone;
+
+  /**
+   * true if data is stored in timestamptz field rather than byte arrays.
+   * allows for lazy conversion to bytes when necessary
+   * false otherwise
+   */
+  private boolean bytesEmpty = true;
+  private boolean timestampTZEmpty = true;
+
+  /* Allow use of external byte[] for efficiency */
+  private byte[] currentBytes;
+  private final byte[] internalBytes = new byte[MAX_BYTES];
+  private byte[] externalBytes;
+  private int offset;
+
+  public TimestampLocalTZWritable() {
+    this.bytesEmpty = false;
+    this.currentBytes = internalBytes;
+    this.offset = 0;
+  }
+
+  public TimestampLocalTZWritable(byte[] bytes, int offset, ZoneId timeZone) {
+    set(bytes, offset, timeZone);
+  }
+
+  public TimestampLocalTZWritable(TimestampLocalTZWritable other) {
+    this(other.getBytes(), 0, other.getTimestampTZ().getZonedDateTime().getZone());
+  }
+
+  public TimestampLocalTZWritable(TimestampTZ tstz) {
+    set(tstz);
+  }
+
+  public void set(byte[] bytes, int offset, ZoneId timeZone) {
+    externalBytes = bytes;
+    this.offset = offset;
+    this.timeZone = timeZone;
+    bytesEmpty = false;
+    timestampTZEmpty = true;
+    currentBytes = externalBytes;
+  }
+
+  public void set(TimestampTZ tstz) {
+    if (tstz == null) {
+      timestampTZ.setZonedDateTime(null);
+      return;
+    }
+    timestampTZ = tstz;
+    timeZone = timestampTZ.getZonedDateTime().getZone();
+    bytesEmpty = true;
+    timestampTZEmpty = false;
+  }
+
+  public void set(TimestampLocalTZWritable t) {
+    if (t.bytesEmpty) {
+      set(t.getTimestampTZ());
+    } else if (t.currentBytes == t.externalBytes) {
+      set(t.currentBytes, t.offset, t.timeZone);
+    } else {
+      set(t.currentBytes, 0, t.timeZone);
+    }
+  }
+
+  public void setTimeZone(ZoneId timeZone) {
+    if (timestampTZ != null) {
+      timestampTZ.setZonedDateTime(
+          timestampTZ.getZonedDateTime().withZoneSameInstant(timeZone));
+    }
+    this.timeZone = timeZone;
+  }
+
+  public ZoneId getTimeZone() {
+    return timeZone;
+  }
+
+  public TimestampTZ getTimestampTZ() {
+    populateTimestampTZ();
+    return timestampTZ;
+  }
+
+  /**
+   * Used to create copies of objects
+   *
+   * @return a copy of the internal TimestampTZWritable byte[]
+   */
+  public byte[] getBytes() {
+    checkBytes();
+
+    int len = getTotalLength();
+    byte[] b = new byte[len];
+
+    System.arraycopy(currentBytes, offset, b, 0, len);
+    return b;
+  }
+
+  /**
+   * @return length of serialized TimestampTZWritable data. As a side effect, populates the internal
+   * byte array if empty.
+   */
+  private int getTotalLength() {
+    checkBytes();
+    return getTotalLength(currentBytes, offset);
+  }
+
+  /**
+   * The data of TimestampTZWritable can be stored either in a byte[]
+   * or in a TimestampTZ object. Calling this method ensures that the byte[]
+   * is populated from the TimestampTZ object if previously empty.
+   */
+  private void checkBytes() {
+    if (bytesEmpty) {
+      populateBytes();
+      offset = 0;
+      currentBytes = internalBytes;
+      bytesEmpty = false;
+    }
+  }
+
+  // Writes the TimestampTZ's serialized value to the internal byte array.
+  private void populateBytes() {
+    Arrays.fill(internalBytes, (byte) 0);
+
+    long seconds = timestampTZ.getEpochSecond();
+    int nanos = timestampTZ.getNanos();
+
+    boolean hasSecondVInt = seconds < 0 || seconds > Integer.MAX_VALUE;
+    boolean hasDecimal = setNanosBytes(nanos, internalBytes, offset + 4, hasSecondVInt);
+
+    int firstInt = (int) seconds;
+    if (hasDecimal || hasSecondVInt) {
+      firstInt |= DECIMAL_OR_SECOND_VINT_FLAG;
+    }
+    intToBytes(firstInt, internalBytes, offset);
+    if (hasSecondVInt) {
+      LazyBinaryUtils.writeVLongToByteArray(internalBytes,
+          offset + 4 + WritableUtils.decodeVIntSize(internalBytes[offset + 4]),
+          seconds >> 31);
+    }
+  }
+
+  private void populateTimestampTZ() {
+    if (timestampTZEmpty) {
+      if (bytesEmpty) {
+        throw new IllegalStateException("Bytes are empty");
+      }
+      long seconds = getSeconds(currentBytes, offset);
+      int nanos = hasDecimalOrSecondVInt(currentBytes[offset]) ? getNanos(currentBytes, offset + 4) : 0;
+      timestampTZ.set(seconds, nanos, timeZone);
+      timestampTZEmpty = false;
+    }
+  }
+
+  public long getSeconds() {
+    if (!timestampTZEmpty) {
+      return timestampTZ.getEpochSecond();
+    } else if (!bytesEmpty) {
+      return getSeconds(currentBytes, offset);
+    }
+    throw new IllegalStateException("Both timestamp and bytes are empty");
+  }
+
+  public int getNanos() {
+    if (!timestampTZEmpty) {
+      return timestampTZ.getNanos();
+    } else if (!bytesEmpty) {
+      return hasDecimalOrSecondVInt(currentBytes[offset]) ? getNanos(currentBytes, offset + 4) : 0;
+    }
+    throw new IllegalStateException("Both timestamp and bytes are empty");
+  }
+
+  @Override
+  public int compareTo(TimestampLocalTZWritable o) {
+    return getTimestampTZ().compareTo(o.getTimestampTZ());
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (o instanceof TimestampLocalTZWritable) {
+      return compareTo((TimestampLocalTZWritable) o) == 0;
+    }
+    return false;
+  }
+
+  @Override
+  public int hashCode() {
+    return getTimestampTZ().hashCode();
+  }
+
+  @Override
+  public String toString() {
+    populateTimestampTZ();
+    return timestampTZ.toString();
+  }
+
+  @Override
+  public void write(DataOutput dataOutput) throws IOException {
+    checkBytes();
+    dataOutput.write(currentBytes, offset, getTotalLength());
+  }
+
+  @Override
+  public void readFields(DataInput dataInput) throws IOException {
+    dataInput.readFully(internalBytes, 0, 4);
+    if (hasDecimalOrSecondVInt(internalBytes[0])) {
+      dataInput.readFully(internalBytes, 4, 1);
+      int len = (byte) WritableUtils.decodeVIntSize(internalBytes[4]);
+      if (len > 1) {
+        dataInput.readFully(internalBytes, 5, len - 1);
+      }
+
+      long vlong = LazyBinaryUtils.readVLongFromByteArray(internalBytes, 4);
+      Preconditions.checkState(vlong >= -1000000000 && vlong <= 999999999,
+          "Invalid nanos value for a TimestampTZWritable: " + vlong +
+              ", expected to be between -1000000000 and 999999999.");
+      if (vlong < 0) {
+        // This indicates there is a second VInt containing the additional bits of the seconds
+        // field.
+        dataInput.readFully(internalBytes, 4 + len, 1);
+        int secondVIntLen = (byte) WritableUtils.decodeVIntSize(internalBytes[4 + len]);
+        if (secondVIntLen > 1) {
+          dataInput.readFully(internalBytes, 5 + len, secondVIntLen - 1);
+        }
+      }
+    }
+    currentBytes = internalBytes;
+    offset = 0;
+    timestampTZEmpty = true;
+    bytesEmpty = false;
+  }
+
+  public byte[] toBinarySortable() {
+    byte[] b = new byte[BINARY_SORTABLE_LENGTH];
+    int nanos = getNanos();
+    // We flip the highest-order bit of the seven-byte representation of seconds to make negative
+    // values come before positive ones.
+    long seconds = getSeconds() ^ SEVEN_BYTE_LONG_SIGN_FLIP;
+    sevenByteLongToBytes(seconds, b, 0);
+    intToBytes(nanos, b, 7);
+    return b;
+  }
+
+  public void fromBinarySortable(byte[] bytes, int binSortOffset, ZoneId timeZone) {
+    // Flip the sign bit (and unused bits of the high-order byte) of the seven-byte long back.
+    long seconds = readSevenByteLong(bytes, binSortOffset) ^ SEVEN_BYTE_LONG_SIGN_FLIP;
+    int nanos = bytesToInt(bytes, binSortOffset + 7);
+    timestampTZ.set(seconds, nanos, timeZone);
+    timestampTZEmpty = false;
+    bytesEmpty = true;
+  }
+
+  public void writeToByteStream(ByteStream.RandomAccessOutput byteStream) {
+    checkBytes();
+    byteStream.write(currentBytes, offset, getTotalLength());
+  }
+
+  /**
+   * Given an integer representing nanoseconds, write its serialized
+   * value to the byte array b at offset
+   *
+   * @param nanos
+   * @param b
+   * @param offset
+   * @return
+   */
+  private static boolean setNanosBytes(int nanos, byte[] b, int offset, boolean hasSecondVInt) {
+    int decimal = 0;
+    if (nanos != 0) {
+      int counter = 0;
+      while (counter < 9) {
+        decimal *= 10;
+        decimal += nanos % 10;
+        nanos /= 10;
+        counter++;
+      }
+    }
+
+    if (hasSecondVInt || decimal != 0) {
+      // We use the sign of the reversed-nanoseconds field to indicate that there is a second VInt
+      // present.
+      LazyBinaryUtils.writeVLongToByteArray(b, offset, hasSecondVInt ? (-decimal - 1) : decimal);
+    }
+    return decimal != 0;
+  }
+
+  public static void setTimestampTZ(TimestampTZ t, byte[] bytes, int offset, ZoneId timeZone) {
+    long seconds = getSeconds(bytes, offset);
+    int nanos = hasDecimalOrSecondVInt(bytes[offset]) ? getNanos(bytes, offset + 4) : 0;
+    t.set(seconds, nanos, timeZone);
+  }
+
+  public static int getTotalLength(byte[] bytes, int offset) {
+    int len = 4;
+    if (hasDecimalOrSecondVInt(bytes[offset])) {
+      int firstVIntLen = WritableUtils.decodeVIntSize(bytes[offset + 4]);
+      len += firstVIntLen;
+      if (hasSecondVInt(bytes[offset + 4])) {
+        len += WritableUtils.decodeVIntSize(bytes[offset + 4 + firstVIntLen]);
+      }
+    }
+    return len;
+  }
+
+  public static long getSeconds(byte[] bytes, int offset) {
+    int firstVInt = bytesToInt(bytes, offset);
+    if (firstVInt >= 0 || !hasSecondVInt(bytes[offset + 4])) {
+      return firstVInt & ~DECIMAL_OR_SECOND_VINT_FLAG;
+    }
+    return ((long) (firstVInt & ~DECIMAL_OR_SECOND_VINT_FLAG)) |
+        (LazyBinaryUtils.readVLongFromByteArray(bytes,
+            offset + 4 + WritableUtils.decodeVIntSize(bytes[offset + 4])) << 31);
+  }
+
+  public static int getNanos(byte[] bytes, int offset) {
+    int val = (int) LazyBinaryUtils.readVLongFromByteArray(bytes, offset);
+    if (val < 0) {
+      val = -val - 1;
+    }
+    int len = (int) Math.floor(Math.log10(val)) + 1;
+
+    // Reverse the value
+    int tmp = 0;
+    while (val != 0) {
+      tmp *= 10;
+      tmp += val % 10;
+      val /= 10;
+    }
+    val = tmp;
+
+    if (len < 9) {
+      val *= Math.pow(10, 9 - len);
+    }
+    return val;
+  }
+
+  private static boolean hasDecimalOrSecondVInt(byte b) {
+    return b < 0;
+  }
+
+  private static boolean hasSecondVInt(byte b) {
+    return WritableUtils.isNegativeVInt(b);
+  }
+
+  /**
+   * Writes <code>value</code> into <code>dest</code> at <code>offset</code>
+   *
+   * @param value
+   * @param dest
+   * @param offset
+   */
+  private static void intToBytes(int value, byte[] dest, int offset) {
+    dest[offset] = (byte) ((value >> 24) & 0xFF);
+    dest[offset + 1] = (byte) ((value >> 16) & 0xFF);
+    dest[offset + 2] = (byte) ((value >> 8) & 0xFF);
+    dest[offset + 3] = (byte) (value & 0xFF);
+  }
+
+  /**
+   * Writes <code>value</code> into <code>dest</code> at <code>offset</code> as a seven-byte
+   * serialized long number.
+   */
+  private static void sevenByteLongToBytes(long value, byte[] dest, int offset) {
+    dest[offset] = (byte) ((value >> 48) & 0xFF);
+    dest[offset + 1] = (byte) ((value >> 40) & 0xFF);
+    dest[offset + 2] = (byte) ((value >> 32) & 0xFF);
+    dest[offset + 3] = (byte) ((value >> 24) & 0xFF);
+    dest[offset + 4] = (byte) ((value >> 16) & 0xFF);
+    dest[offset + 5] = (byte) ((value >> 8) & 0xFF);
+    dest[offset + 6] = (byte) (value & 0xFF);
+  }
+
+  /**
+   * @param bytes
+   * @param offset
+   * @return integer represented by the four bytes in <code>bytes</code>
+   * beginning at <code>offset</code>
+   */
+  private static int bytesToInt(byte[] bytes, int offset) {
+    return ((0xFF & bytes[offset]) << 24)
+        | ((0xFF & bytes[offset + 1]) << 16)
+        | ((0xFF & bytes[offset + 2]) << 8)
+        | (0xFF & bytes[offset + 3]);
+  }
+
+  private static long readSevenByteLong(byte[] bytes, int offset) {
+    // We need to shift everything 8 bits left and then shift back to populate the sign field.
+    return (((0xFFL & bytes[offset]) << 56)
+        | ((0xFFL & bytes[offset + 1]) << 48)
+        | ((0xFFL & bytes[offset + 2]) << 40)
+        | ((0xFFL & bytes[offset + 3]) << 32)
+        | ((0xFFL & bytes[offset + 4]) << 24)
+        | ((0xFFL & bytes[offset + 5]) << 16)
+        | ((0xFFL & bytes[offset + 6]) << 8)) >> 8;
+  }
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampTZWritable.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampTZWritable.java b/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampTZWritable.java
deleted file mode 100644
index 8c3f8f6..0000000
--- a/serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampTZWritable.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hive.serde2.io;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.hive.common.type.TimestampTZ;
-import org.apache.hadoop.hive.serde2.ByteStream;
-import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.io.WritableUtils;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * Writable for TimestampTZ. Copied from TimestampWritable.
- * After we replace {@link java.sql.Timestamp} with {@link java.time.LocalDateTime} for Timestamp,
- * it'll need a new Writable.
- */
-public class TimestampTZWritable implements WritableComparable<TimestampTZWritable> {
-
-  public static final byte[] nullBytes = {0x0, 0x0, 0x0, 0x0};
-  private static final int DECIMAL_OR_SECOND_VINT_FLAG = 1 << 31;
-  private static final long SEVEN_BYTE_LONG_SIGN_FLIP = 0xff80L << 48; // only need flip the MSB?
-
-  /**
-   * The maximum number of bytes required for a TimestampWritable
-   */
-  public static final int MAX_BYTES = 13;
-
-  public static final int BINARY_SORTABLE_LENGTH = 11;
-
-  private TimestampTZ timestampTZ = new TimestampTZ();
-
-  /**
-   * true if data is stored in timestamptz field rather than byte arrays.
-   * allows for lazy conversion to bytes when necessary
-   * false otherwise
-   */
-  private boolean bytesEmpty = true;
-  private boolean timestampTZEmpty = true;
-
-  /* Allow use of external byte[] for efficiency */
-  private byte[] currentBytes;
-  private final byte[] internalBytes = new byte[MAX_BYTES];
-  private byte[] externalBytes;
-  private int offset;
-
-  public TimestampTZWritable() {
-    bytesEmpty = false;
-    currentBytes = internalBytes;
-    offset = 0;
-  }
-
-  public TimestampTZWritable(byte[] bytes, int offset) {
-    set(bytes, offset);
-  }
-
-  public TimestampTZWritable(TimestampTZWritable other) {
-    this(other.getBytes(), 0);
-  }
-
-  public TimestampTZWritable(TimestampTZ tstz) {
-    set(tstz);
-  }
-
-  public void set(byte[] bytes, int offset) {
-    externalBytes = bytes;
-    this.offset = offset;
-    bytesEmpty = false;
-    timestampTZEmpty = true;
-    currentBytes = externalBytes;
-  }
-
-  public void set(TimestampTZ tstz) {
-    if (tstz == null) {
-      timestampTZ.setZonedDateTime(null);
-      return;
-    }
-    timestampTZ = tstz;
-    bytesEmpty = true;
-    timestampTZEmpty = false;
-  }
-
-  public void set(TimestampTZWritable t) {
-    if (t.bytesEmpty) {
-      set(t.getTimestampTZ());
-    } else if (t.currentBytes == t.externalBytes) {
-      set(t.currentBytes, t.offset);
-    } else {
-      set(t.currentBytes, 0);
-    }
-  }
-
-  public TimestampTZ getTimestampTZ() {
-    populateTimestampTZ();
-    return timestampTZ;
-  }
-
-  /**
-   * Used to create copies of objects
-   *
-   * @return a copy of the internal TimestampTZWritable byte[]
-   */
-  public byte[] getBytes() {
-    checkBytes();
-
-    int len = getTotalLength();
-    byte[] b = new byte[len];
-
-    System.arraycopy(currentBytes, offset, b, 0, len);
-    return b;
-  }
-
-  /**
-   * @return length of serialized TimestampTZWritable data. As a side effect, populates the internal
-   * byte array if empty.
-   */
-  private int getTotalLength() {
-    checkBytes();
-    return getTotalLength(currentBytes, offset);
-  }
-
-  /**
-   * The data of TimestampTZWritable can be stored either in a byte[]
-   * or in a TimestampTZ object. Calling this method ensures that the byte[]
-   * is populated from the TimestampTZ object if previously empty.
-   */
-  private void checkBytes() {
-    if (bytesEmpty) {
-      populateBytes();
-      offset = 0;
-      currentBytes = internalBytes;
-      bytesEmpty = false;
-    }
-  }
-
-  // Writes the TimestampTZ's serialized value to the internal byte array.
-  private void populateBytes() {
-    Arrays.fill(internalBytes, (byte) 0);
-
-    long seconds = timestampTZ.getEpochSecond();
-    int nanos = timestampTZ.getNanos();
-
-    boolean hasSecondVInt = seconds < 0 || seconds > Integer.MAX_VALUE;
-    boolean hasDecimal = setNanosBytes(nanos, internalBytes, offset + 4, hasSecondVInt);
-
-    int firstInt = (int) seconds;
-    if (hasDecimal || hasSecondVInt) {
-      firstInt |= DECIMAL_OR_SECOND_VINT_FLAG;
-    }
-    intToBytes(firstInt, internalBytes, offset);
-    if (hasSecondVInt) {
-      LazyBinaryUtils.writeVLongToByteArray(internalBytes,
-          offset + 4 + WritableUtils.decodeVIntSize(internalBytes[offset + 4]),
-          seconds >> 31);
-    }
-  }
-
-  private void populateTimestampTZ() {
-    if (timestampTZEmpty) {
-      long seconds = getSeconds();
-      int nanos = getNanos();
-      timestampTZ.set(seconds, nanos);
-      timestampTZEmpty = false;
-    }
-  }
-
-  public long getSeconds() {
-    if (!timestampTZEmpty) {
-      return timestampTZ.getEpochSecond();
-    } else if (!bytesEmpty) {
-      return getSeconds(currentBytes, offset);
-    }
-    throw new IllegalStateException("Both timestamp and bytes are empty");
-  }
-
-  public int getNanos() {
-    if (!timestampTZEmpty) {
-      return timestampTZ.getNanos();
-    } else if (!bytesEmpty) {
-      return hasDecimalOrSecondVInt(currentBytes[offset]) ? getNanos(currentBytes, offset + 4) : 0;
-    }
-    throw new IllegalStateException("Both timestamp and bytes are empty");
-  }
-
-  @Override
-  public int compareTo(TimestampTZWritable o) {
-    return getTimestampTZ().compareTo(o.getTimestampTZ());
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (o instanceof TimestampTZWritable) {
-      return compareTo((TimestampTZWritable) o) == 0;
-    }
-    return false;
-  }
-
-  @Override
-  public int hashCode() {
-    return getTimestampTZ().hashCode();
-  }
-
-  @Override
-  public String toString() {
-    populateTimestampTZ();
-    return timestampTZ.toString();
-  }
-
-  @Override
-  public void write(DataOutput dataOutput) throws IOException {
-    checkBytes();
-    dataOutput.write(currentBytes, offset, getTotalLength());
-  }
-
-  @Override
-  public void readFields(DataInput dataInput) throws IOException {
-    dataInput.readFully(internalBytes, 0, 4);
-    if (hasDecimalOrSecondVInt(internalBytes[0])) {
-      dataInput.readFully(internalBytes, 4, 1);
-      int len = (byte) WritableUtils.decodeVIntSize(internalBytes[4]);
-      if (len > 1) {
-        dataInput.readFully(internalBytes, 5, len - 1);
-      }
-
-      long vlong = LazyBinaryUtils.readVLongFromByteArray(internalBytes, 4);
-      Preconditions.checkState(vlong >= -1000000000 && vlong <= 999999999,
-          "Invalid nanos value for a TimestampTZWritable: " + vlong +
-              ", expected to be between -1000000000 and 999999999.");
-      if (vlong < 0) {
-        // This indicates there is a second VInt containing the additional bits of the seconds
-        // field.
-        dataInput.readFully(internalBytes, 4 + len, 1);
-        int secondVIntLen = (byte) WritableUtils.decodeVIntSize(internalBytes[4 + len]);
-        if (secondVIntLen > 1) {
-          dataInput.readFully(internalBytes, 5 + len, secondVIntLen - 1);
-        }
-      }
-    }
-    currentBytes = internalBytes;
-    offset = 0;
-    timestampTZEmpty = true;
-    bytesEmpty = false;
-  }
-
-  public byte[] toBinarySortable() {
-    byte[] b = new byte[BINARY_SORTABLE_LENGTH];
-    int nanos = getNanos();
-    // We flip the highest-order bit of the seven-byte representation of seconds to make negative
-    // values come before positive ones.
-    long seconds = getSeconds() ^ SEVEN_BYTE_LONG_SIGN_FLIP;
-    sevenByteLongToBytes(seconds, b, 0);
-    intToBytes(nanos, b, 7);
-    return b;
-  }
-
-  public void fromBinarySortable(byte[] bytes, int binSortOffset) {
-    // Flip the sign bit (and unused bits of the high-order byte) of the seven-byte long back.
-    long seconds = readSevenByteLong(bytes, binSortOffset) ^ SEVEN_BYTE_LONG_SIGN_FLIP;
-    int nanos = bytesToInt(bytes, binSortOffset + 7);
-    timestampTZ.set(seconds, nanos);
-    timestampTZEmpty = false;
-    bytesEmpty = true;
-  }
-
-  public void writeToByteStream(ByteStream.RandomAccessOutput byteStream) {
-    checkBytes();
-    byteStream.write(currentBytes, offset, getTotalLength());
-  }
-
-  /**
-   * Given an integer representing nanoseconds, write its serialized
-   * value to the byte array b at offset
-   *
-   * @param nanos
-   * @param b
-   * @param offset
-   * @return
-   */
-  private static boolean setNanosBytes(int nanos, byte[] b, int offset, boolean hasSecondVInt) {
-    int decimal = 0;
-    if (nanos != 0) {
-      int counter = 0;
-      while (counter < 9) {
-        decimal *= 10;
-        decimal += nanos % 10;
-        nanos /= 10;
-        counter++;
-      }
-    }
-
-    if (hasSecondVInt || decimal != 0) {
-      // We use the sign of the reversed-nanoseconds field to indicate that there is a second VInt
-      // present.
-      LazyBinaryUtils.writeVLongToByteArray(b, offset, hasSecondVInt ? (-decimal - 1) : decimal);
-    }
-    return decimal != 0;
-  }
-
-  public static void setTimestampTZ(TimestampTZ t, byte[] bytes, int offset) {
-    long seconds = getSeconds(bytes, offset);
-    int nanos = hasDecimalOrSecondVInt(bytes[offset]) ? getNanos(bytes, offset + 4) : 0;
-    t.set(seconds, nanos);
-  }
-
-  public static int getTotalLength(byte[] bytes, int offset) {
-    int len = 4;
-    if (hasDecimalOrSecondVInt(bytes[offset])) {
-      int firstVIntLen = WritableUtils.decodeVIntSize(bytes[offset + 4]);
-      len += firstVIntLen;
-      if (hasSecondVInt(bytes[offset + 4])) {
-        len += WritableUtils.decodeVIntSize(bytes[offset + 4 + firstVIntLen]);
-      }
-    }
-    return len;
-  }
-
-  public static long getSeconds(byte[] bytes, int offset) {
-    int firstVInt = bytesToInt(bytes, offset);
-    if (firstVInt >= 0 || !hasSecondVInt(bytes[offset + 4])) {
-      return firstVInt & ~DECIMAL_OR_SECOND_VINT_FLAG;
-    }
-    return ((long) (firstVInt & ~DECIMAL_OR_SECOND_VINT_FLAG)) |
-        (LazyBinaryUtils.readVLongFromByteArray(bytes,
-            offset + 4 + WritableUtils.decodeVIntSize(bytes[offset + 4])) << 31);
-  }
-
-  public static int getNanos(byte[] bytes, int offset) {
-    int val = (int) LazyBinaryUtils.readVLongFromByteArray(bytes, offset);
-    if (val < 0) {
-      val = -val - 1;
-    }
-    int len = (int) Math.floor(Math.log10(val)) + 1;
-
-    // Reverse the value
-    int tmp = 0;
-    while (val != 0) {
-      tmp *= 10;
-      tmp += val % 10;
-      val /= 10;
-    }
-    val = tmp;
-
-    if (len < 9) {
-      val *= Math.pow(10, 9 - len);
-    }
-    return val;
-  }
-
-  private static boolean hasDecimalOrSecondVInt(byte b) {
-    return b < 0;
-  }
-
-  private static boolean hasSecondVInt(byte b) {
-    return WritableUtils.isNegativeVInt(b);
-  }
-
-  /**
-   * Writes <code>value</code> into <code>dest</code> at <code>offset</code>
-   *
-   * @param value
-   * @param dest
-   * @param offset
-   */
-  private static void intToBytes(int value, byte[] dest, int offset) {
-    dest[offset] = (byte) ((value >> 24) & 0xFF);
-    dest[offset + 1] = (byte) ((value >> 16) & 0xFF);
-    dest[offset + 2] = (byte) ((value >> 8) & 0xFF);
-    dest[offset + 3] = (byte) (value & 0xFF);
-  }
-
-  /**
-   * Writes <code>value</code> into <code>dest</code> at <code>offset</code> as a seven-byte
-   * serialized long number.
-   */
-  private static void sevenByteLongToBytes(long value, byte[] dest, int offset) {
-    dest[offset] = (byte) ((value >> 48) & 0xFF);
-    dest[offset + 1] = (byte) ((value >> 40) & 0xFF);
-    dest[offset + 2] = (byte) ((value >> 32) & 0xFF);
-    dest[offset + 3] = (byte) ((value >> 24) & 0xFF);
-    dest[offset + 4] = (byte) ((value >> 16) & 0xFF);
-    dest[offset + 5] = (byte) ((value >> 8) & 0xFF);
-    dest[offset + 6] = (byte) (value & 0xFF);
-  }
-
-  /**
-   * @param bytes
-   * @param offset
-   * @return integer represented by the four bytes in <code>bytes</code>
-   * beginning at <code>offset</code>
-   */
-  private static int bytesToInt(byte[] bytes, int offset) {
-    return ((0xFF & bytes[offset]) << 24)
-        | ((0xFF & bytes[offset + 1]) << 16)
-        | ((0xFF & bytes[offset + 2]) << 8)
-        | (0xFF & bytes[offset + 3]);
-  }
-
-  private static long readSevenByteLong(byte[] bytes, int offset) {
-    // We need to shift everything 8 bits left and then shift back to populate the sign field.
-    return (((0xFFL & bytes[offset]) << 56)
-        | ((0xFFL & bytes[offset + 1]) << 48)
-        | ((0xFFL & bytes[offset + 2]) << 40)
-        | ((0xFFL & bytes[offset + 3]) << 32)
-        | ((0xFFL & bytes[offset + 4]) << 24)
-        | ((0xFFL & bytes[offset + 5]) << 16)
-        | ((0xFFL & bytes[offset + 6]) << 8)) >> 8;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java
index f87ac76..3ed5b33 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java
@@ -46,7 +46,7 @@ import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyPrimitiv
 import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyShortObjectInspector;
 import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyStringObjectInspector;
 import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampObjectInspector;
-import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampTZObjectInspector;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampLocalTZObjectInspector;
 import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyVoidObjectInspector;
 import org.apache.hadoop.hive.serde2.lazydio.LazyDioBinary;
 import org.apache.hadoop.hive.serde2.lazydio.LazyDioBoolean;
@@ -129,8 +129,8 @@ public final class LazyFactory {
       return new LazyDate((LazyDateObjectInspector) oi);
     case TIMESTAMP:
       return new LazyTimestamp((LazyTimestampObjectInspector) oi);
-    case TIMESTAMPTZ:
-      return new LazyTimestampTZ((LazyTimestampTZObjectInspector) oi);
+    case TIMESTAMPLOCALTZ:
+      return new LazyTimestampLocalTZ((LazyTimestampLocalTZObjectInspector) oi);
     case INTERVAL_YEAR_MONTH:
       return new LazyHiveIntervalYearMonth((LazyHiveIntervalYearMonthObjectInspector) oi);
     case INTERVAL_DAY_TIME:

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySerDeParameters.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySerDeParameters.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySerDeParameters.java
index ee4bb34..fe3f356 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySerDeParameters.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazySerDeParameters.java
@@ -23,8 +23,6 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hive.common.classification.InterfaceAudience.Public;
 import org.apache.hadoop.hive.common.classification.InterfaceStability.Stable;
@@ -33,11 +31,14 @@ import org.apache.hadoop.hive.serde.serdeConstants;
 import org.apache.hadoop.hive.serde2.SerDeException;
 import org.apache.hadoop.hive.serde2.SerDeUtils;
 import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyObjectInspectorParameters;
+import org.apache.hadoop.hive.serde2.typeinfo.TimestampLocalTZTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
 import org.apache.hadoop.io.Text;
 import org.apache.hive.common.util.HiveStringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * SerDeParameters.
@@ -88,7 +89,7 @@ public class LazySerDeParameters implements LazyObjectInspectorParameters {
     lastColumnTakesRest = (lastColumnTakesRestString != null && lastColumnTakesRestString
         .equalsIgnoreCase("true"));
 
-    extractColumnInfo();
+    extractColumnInfo(job);
 
     // Create the LazyObject for storing the rows
     rowTypeInfo = TypeInfoFactory.getStructTypeInfo(columnNames, columnTypes);
@@ -133,7 +134,7 @@ public class LazySerDeParameters implements LazyObjectInspectorParameters {
    * Extracts and set column names and column types from the table properties
    * @throws SerDeException
    */
-  public void extractColumnInfo() throws SerDeException {
+  public void extractColumnInfo(Configuration conf) throws SerDeException {
     // Read the configuration parameters
     String columnNameProperty = tableProperties.getProperty(serdeConstants.LIST_COLUMNS);
     // NOTE: if "columns.types" is missing, all columns will be of String type
@@ -160,6 +161,16 @@ public class LazySerDeParameters implements LazyObjectInspectorParameters {
     }
 
     columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty);
+    // Insert time-zone for timestamp type
+    if (conf != null) {
+      final TimestampLocalTZTypeInfo tsTZTypeInfo = new TimestampLocalTZTypeInfo(
+          conf.get(ConfVars.HIVE_LOCAL_TIME_ZONE.varname));
+      for (int i = 0; i < columnTypes.size(); i++) {
+        if (columnTypes.get(i) instanceof TimestampLocalTZTypeInfo) {
+          columnTypes.set(i, tsTZTypeInfo);
+        }
+      }
+    }
 
     if (columnNames.size() != columnTypes.size()) {
       throw new SerDeException(serdeName + ": columns has " + columnNames.size()

http://git-wip-us.apache.org/repos/asf/hive/blob/34eebff1/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyTimestampLocalTZ.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyTimestampLocalTZ.java b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyTimestampLocalTZ.java
new file mode 100644
index 0000000..ce5f202
--- /dev/null
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyTimestampLocalTZ.java
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.serde2.lazy;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.time.ZoneId;
+import java.time.format.DateTimeParseException;
+
+import org.apache.hadoop.hive.common.type.TimestampTZ;
+import org.apache.hadoop.hive.common.type.TimestampTZUtil;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.io.TimestampLocalTZWritable;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampLocalTZObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.TimestampLocalTZTypeInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * LazyPrimitive for TimestampLocalTZ. Similar to LazyTimestamp.
+ */
+public class LazyTimestampLocalTZ extends
+    LazyPrimitive<LazyTimestampLocalTZObjectInspector, TimestampLocalTZWritable> {
+
+  private static final Logger LOG = LoggerFactory.getLogger(LazyTimestampLocalTZ.class);
+
+  private ZoneId timeZone;
+
+  public LazyTimestampLocalTZ(LazyTimestampLocalTZObjectInspector lazyTimestampTZObjectInspector) {
+    super(lazyTimestampTZObjectInspector);
+    TimestampLocalTZTypeInfo typeInfo = (TimestampLocalTZTypeInfo) oi.getTypeInfo();
+    if (typeInfo == null) {
+      throw new RuntimeException("TimestampLocalTZ type used without type params");
+    }
+    timeZone = typeInfo.timeZone();
+    data = new TimestampLocalTZWritable();
+  }
+
+  public LazyTimestampLocalTZ(LazyTimestampLocalTZ copy) {
+    super(copy);
+    timeZone = copy.timeZone;
+    data = new TimestampLocalTZWritable(copy.data);
+  }
+
+  @Override
+  public void init(ByteArrayRef bytes, int start, int length) {
+    String s = null;
+    if (!LazyUtils.isDateMaybe(bytes.getData(), start, length)) {
+      isNull = true;
+      return;
+    }
+
+    TimestampTZ t = null;
+    try {
+      s = new String(bytes.getData(), start, length, "US-ASCII");
+      if (s.equals("NULL")) {
+        isNull = true;
+        logExceptionMessage(bytes, start, length,
+            serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME.toUpperCase());
+      } else {
+        t = TimestampTZUtil.parse(s, timeZone);
+        isNull = false;
+      }
+    } catch (UnsupportedEncodingException e) {
+      isNull = true;
+      LOG.error("Unsupported encoding found ", e);
+    } catch (DateTimeParseException e) {
+      isNull = true;
+      logExceptionMessage(bytes, start, length, serdeConstants.TIMESTAMPLOCALTZ_TYPE_NAME.toUpperCase());
+    }
+    data.set(t);
+  }
+
+  @Override
+  public TimestampLocalTZWritable getWritableObject() {
+    return data;
+  }
+
+  public static void writeUTF8(OutputStream out, TimestampLocalTZWritable i) throws IOException {
+    if (i == null) {
+      out.write(TimestampLocalTZWritable.nullBytes);
+    } else {
+      out.write(i.toString().getBytes("US-ASCII"));
+    }
+  }
+}


Mime
View raw message