Takahiko Saito created HIVE-13779:
-------------------------------------
Summary: Fraction of second is lost when you change column from
timestamp to string
Key: HIVE-13779
URL: https://issues.apache.org/jira/browse/HIVE-13779
Project: Hive
Issue Type: Bug
Affects Versions: 1.2.1, 2.1.0
Reporter: Takahiko Saito
I have this table:
{noformat}
0: jdbc:hive2://os-r6-0517-hiveserver2-1-1.op> select s, ts from schemaevo
limit 10;
+-------------------+------------------------+--+
| s | ts |
+-------------------+------------------------+--+
| david falkner | 2076-08-03 22:22:45.0 |
| oscar miller | 2027-05-23 18:51:23.0 |
| david xylophone | 2031-02-07 13:02:38.0 |
| katie allen | 2035-04-22 08:02:07.0 |
| zach johnson | 2074-02-21 18:25:58.0 |
| mike brown | 2029-05-23 04:09:04.0 |
| luke garcia | 2059-03-14 12:37:41.0 |
| xavier garcia | 2025-04-22 11:23:44.0 |
| holly laertes | 2037-01-20 08:02:40.0 |
| xavier underhill | 2072-08-16 07:41:05.0 |
+-------------------+------------------------+--+
{noformat}
Then run the followings:
{noformat}
set hive.metastore.disallow.incompatible.col.type.changes = false;
drop table if exists
shcemaevo_vectorization_true_fileformat_orc_timestamp_string;
create table shcemaevo_vectorization_true_fileformat_orc_timestamp_string
stored as orc as select s, ts from schemaevo;
alter table shcemaevo_vectorization_true_fileformat_orc_timestamp_string change
column ts ts string;
{noformat}
The below shows that the changed column lose fraction of second:
{noformat}
0: jdbc:hive2://os-r6-0517-hiveserver2-1-1.op> select * from
shcemaevo_vectorization_true_fileformat_orc_timestamp_string limit 10;
+-----------------------------------------------------------------+------------------------------------------------------------------+--+
| shcemaevo_vectorization_true_fileformat_orc_timestamp_string.s |
shcemaevo_vectorization_true_fileformat_orc_timestamp_string.ts |
+-----------------------------------------------------------------+------------------------------------------------------------------+--+
| david falkner | 2076-08-03
22:22:45 |
| oscar miller | 2027-05-23
18:51:23 |
| david xylophone | 2031-02-07
13:02:38 |
| katie allen | 2035-04-22
08:02:07 |
| zach johnson | 2074-02-21
18:25:58 |
| mike brown | 2029-05-23
04:09:04 |
| luke garcia | 2059-03-14
12:37:41 |
| xavier garcia | 2025-04-22
11:23:44 |
| holly laertes | 2037-01-20
08:02:40 |
| xavier underhill | 2072-08-16
07:41:05 |
+-----------------------------------------------------------------+------------------------------------------------------------------+--+
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)