- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Hive Alter column type
- Labels:
-
Apache Hive
Created 01-29-2016 01:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
I am using hive 1.2.1.
I executed the following command to change the type of a column from timestamp to date
ALTER TABLE table_name CHANGE column_name column_name date CASCADE;
the command was executed successfully.
when i want to retrieve the data from the table using: select * from table_name
I got the following error:
Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.TimestampWritable cannot be cast to org.apache.hadoop.hive.serde2.io.DateWritable
thanks for help.
Created 01-29-2016 01:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It has to do with the dataset in the table. Check if date has proper fields.
Good reference
Created 01-29-2016 01:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It has to do with the dataset in the table. Check if date has proper fields.
Good reference
Created 01-29-2016 01:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot for your help.
Effectively, if the data was stored already with timetamp type and the we change the type, the select will not work and we will have the ClassCastException.
If no data was alreday stored with the timestamp type (all values are null) and then we change the type , the select works fine.
