rcongiu / Hive-JSON-Serde

Read - Write JSON SerDe for Apache Hive.
Other
733 stars 393 forks source link

java.lang.String cannot be cast to java.sql.Date #124

Closed m1racoli closed 7 years ago

m1racoli commented 8 years ago

While using the date type in Hive with the Hive-JSON-Serde the following error occurs, when just doing a simple SELECT * on that table:

Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: java.lang.String cannot be cast to java.sql.Date
rcongiu commented 8 years ago

date was added into hive 1.2.0. I didn't know...anyway, I coded support for it and pushed it to the develop branch, you can pull it from there and give it a try. Seems to be working but haven't tested it thoroughly.

{"a": "something", "b": "2015-12-10"  }

create table json_date (
  a  string ,
  b  date  
) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
STORED AS TEXTFILE;

hive> select * from json_date;
OK
something   2015-12-10
rcongiu commented 7 years ago

Seems like it's working... closing