-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Trino does not respect Calendar type used for writing date and timestamp.
Trino may wrongly read dates/timestamps before the switch to Gregorian Calendar (Oct 15th, 1582) if Orc file has dates/timestmap was written with other calendar then Proleptic Gregorian.
Hive by default uses Hybrid Calendar and Trino by default uses Proleptic Gregorian Calendar.
In case Trino read file written by Hive, Trino will treat dates/timestamp before Oct 15th, 1582 as written using Proleptic Gregorian Calendar what can result in incorrect value.
Hive:
create table t (date_col date, tmst_col timestamp) stored as ORC;
insert into t values ('0001-01-01', '0001-01-01 01:01:01.123');
insert into t values ('1582-11-01', '1582-11-01 01:01:01.123')
+-------------+--------------------------+
| t.date_col | t.tmst_col |
+-------------+--------------------------+
| 0001-01-01 | 0001-01-01 01:01:01.123 |
| 1582-11-01 | 1582-11-01 01:01:01.123 |
+-------------+--------------------------+
Trino:
select * from t;
date_col | tmst_col
------------+-------------------------
1582-11-01 | 1582-11-01 01:01:01.123
0000-12-30 | 0000-12-30 01:01:01.123