This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new b823b5c146f HIVE-29487: Iceberg: [V3] Add support for timestamp with
nanosecond precession with TIMESTAMPLOCALTZ (#6351)
b823b5c146f is described below
commit b823b5c146fbedbdd4b29cc4c8e33b8a05f047e5
Author: Ayush Saxena <[email protected]>
AuthorDate: Fri Mar 6 22:36:44 2026 +0530
HIVE-29487: Iceberg: [V3] Add support for timestamp with nanosecond
precession with TIMESTAMPLOCALTZ (#6351)
---
.../src/test/queries/positive/timestamp_ns.q | 10 +++++---
.../src/test/results/positive/timestamp_ns.q.out | 30 ++++++++++++++--------
.../org/apache/hadoop/hive/ql/parse/HiveParser.g | 2 +-
3 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/iceberg/iceberg-handler/src/test/queries/positive/timestamp_ns.q
b/iceberg/iceberg-handler/src/test/queries/positive/timestamp_ns.q
index a9f6d78ab44..0ba50506099 100644
--- a/iceberg/iceberg-handler/src/test/queries/positive/timestamp_ns.q
+++ b/iceberg/iceberg-handler/src/test/queries/positive/timestamp_ns.q
@@ -13,15 +13,19 @@
--! qt:replace:/(\S\"total-files-size":")(\d+)(")/$1#Masked#$3/
CREATE TABLE t (
- ts_us timestamp,
+ ts_ms timestamp,
ts_ns timestamp(9),
- ts_tz_us timestamp with local time zone,
- ts_tz_ns timestamp with local time zone(9)
+ ts_tz_ms timestamp with local time zone,
+ ts_tz_ns timestamp with local time zone(9),
+ ts_local_tz_ms TIMESTAMPLOCALTZ,
+ ts_local_tz_ns TIMESTAMPLOCALTZ(9)
)
STORED BY ICEBERG
TBLPROPERTIES ('format-version'='3');
INSERT INTO t VALUES (
+ '2025-12-18 10:15:30.123456789',
+ '2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
diff --git
a/iceberg/iceberg-handler/src/test/results/positive/timestamp_ns.q.out
b/iceberg/iceberg-handler/src/test/results/positive/timestamp_ns.q.out
index c3223d3856d..cdd203768df 100644
--- a/iceberg/iceberg-handler/src/test/results/positive/timestamp_ns.q.out
+++ b/iceberg/iceberg-handler/src/test/results/positive/timestamp_ns.q.out
@@ -1,8 +1,10 @@
PREHOOK: query: CREATE TABLE t (
- ts_us timestamp,
+ ts_ms timestamp,
ts_ns timestamp(9),
- ts_tz_us timestamp with local time zone,
- ts_tz_ns timestamp with local time zone(9)
+ ts_tz_ms timestamp with local time zone,
+ ts_tz_ns timestamp with local time zone(9),
+ ts_local_tz_ms TIMESTAMPLOCALTZ,
+ ts_local_tz_ns TIMESTAMPLOCALTZ(9)
)
STORED BY ICEBERG
TBLPROPERTIES ('format-version'='3')
@@ -10,10 +12,12 @@ PREHOOK: type: CREATETABLE
PREHOOK: Output: database:default
PREHOOK: Output: default@t
POSTHOOK: query: CREATE TABLE t (
- ts_us timestamp,
+ ts_ms timestamp,
ts_ns timestamp(9),
- ts_tz_us timestamp with local time zone,
- ts_tz_ns timestamp with local time zone(9)
+ ts_tz_ms timestamp with local time zone,
+ ts_tz_ns timestamp with local time zone(9),
+ ts_local_tz_ms TIMESTAMPLOCALTZ,
+ ts_local_tz_ns TIMESTAMPLOCALTZ(9)
)
STORED BY ICEBERG
TBLPROPERTIES ('format-version'='3')
@@ -21,6 +25,8 @@ POSTHOOK: type: CREATETABLE
POSTHOOK: Output: database:default
POSTHOOK: Output: default@t
PREHOOK: query: INSERT INTO t VALUES (
+ '2025-12-18 10:15:30.123456789',
+ '2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
@@ -30,6 +36,8 @@ PREHOOK: type: QUERY
PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@t
POSTHOOK: query: INSERT INTO t VALUES (
+ '2025-12-18 10:15:30.123456789',
+ '2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
'2025-12-18 10:15:30.123456789',
@@ -82,7 +90,7 @@ POSTHOOK: query: SELECT * FROM t
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t
POSTHOOK: Output: hdfs://### HDFS PATH ###
-2025-12-18 10:15:30.123456 2025-12-18 10:15:30.123456789 2025-12-18
10:15:30.123456 US/Pacific 2025-12-18 10:15:30.123456789 US/Pacific
+2025-12-18 10:15:30.123456 2025-12-18 10:15:30.123456789 2025-12-18
10:15:30.123456 US/Pacific 2025-12-18 10:15:30.123456789 US/Pacific
2025-12-18 10:15:30.123456 US/Pacific 2025-12-18 10:15:30.123456789 US/Pacific
PREHOOK: query: CREATE TABLE tgt STORED BY ICEBERG TBLPROPERTIES
('format-version'='3') AS SELECT * FROM t
PREHOOK: type: CREATETABLE_AS_SELECT
PREHOOK: Input: default@t
@@ -95,10 +103,12 @@ POSTHOOK: Input: default@t
POSTHOOK: Output: database:default
POSTHOOK: Output: default@tgt
POSTHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: Lineage: tgt.ts_local_tz_ms SIMPLE
[(t)t.FieldSchema(name:ts_local_tz_ms, type:timestamp with local time zone,
comment:null), ]
+POSTHOOK: Lineage: tgt.ts_local_tz_ns SIMPLE
[(t)t.FieldSchema(name:ts_local_tz_ns, type:timestamp with local time zone(9),
comment:null), ]
+POSTHOOK: Lineage: tgt.ts_ms SIMPLE [(t)t.FieldSchema(name:ts_ms,
type:timestamp, comment:null), ]
POSTHOOK: Lineage: tgt.ts_ns SIMPLE [(t)t.FieldSchema(name:ts_ns,
type:timestamp(9), comment:null), ]
+POSTHOOK: Lineage: tgt.ts_tz_ms SIMPLE [(t)t.FieldSchema(name:ts_tz_ms,
type:timestamp with local time zone, comment:null), ]
POSTHOOK: Lineage: tgt.ts_tz_ns SIMPLE [(t)t.FieldSchema(name:ts_tz_ns,
type:timestamp with local time zone(9), comment:null), ]
-POSTHOOK: Lineage: tgt.ts_tz_us SIMPLE [(t)t.FieldSchema(name:ts_tz_us,
type:timestamp with local time zone, comment:null), ]
-POSTHOOK: Lineage: tgt.ts_us SIMPLE [(t)t.FieldSchema(name:ts_us,
type:timestamp, comment:null), ]
PREHOOK: query: SELECT * FROM tgt
PREHOOK: type: QUERY
PREHOOK: Input: default@tgt
@@ -107,4 +117,4 @@ POSTHOOK: query: SELECT * FROM tgt
POSTHOOK: type: QUERY
POSTHOOK: Input: default@tgt
POSTHOOK: Output: hdfs://### HDFS PATH ###
-2025-12-18 10:15:30.123456 2025-12-18 10:15:30.123456789 2025-12-18
10:15:30.123456 US/Pacific 2025-12-18 10:15:30.123456789 US/Pacific
+2025-12-18 10:15:30.123456 2025-12-18 10:15:30.123456789 2025-12-18
10:15:30.123456 US/Pacific 2025-12-18 10:15:30.123456789 US/Pacific
2025-12-18 10:15:30.123456 US/Pacific 2025-12-18 10:15:30.123456789 US/Pacific
diff --git a/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
b/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index 54417ff0fcb..a8be789c703 100644
--- a/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -2434,7 +2434,7 @@ primitiveType
| KW_DOUBLE KW_PRECISION? -> TOK_DOUBLE
| KW_DATE -> TOK_DATE
| KW_DATETIME -> TOK_DATETIME
- | KW_TIMESTAMPLOCALTZ -> TOK_TIMESTAMPLOCALTZ
+ | KW_TIMESTAMPLOCALTZ (LPAREN p=Number RPAREN)? -> ^(TOK_TIMESTAMPLOCALTZ
$p?)
| KW_TIMESTAMP
(
KW_WITH KW_LOCAL KW_TIME KW_ZONE