rcongiu / Hive-JSON-Serde

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

Fields having Timestamp DataType are not getting written to File in Serialize of JsonSerde #91

Closed appanasatya closed 7 years ago

appanasatya commented 10 years ago

Timestamp field and value is not even reflecting in the file that hive external table is pointing to.

Create external table satya(a int , b timestamp)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
location '/tmp/satya';
insert into table satya select 1,1411286918 from different_table limit 1;
insert into table satya select 1,1411286918.986 from different_table limit 1;
insert into table satya select 1,"2014-09-16 12:13:14.0" from different_table limit 1;

Hive Timestamp DataType Reference

hadoop fs -cat /tmp/satya;
{"a":1}
bigwheel commented 9 years ago

Because there is no case for TIMESTAMP in there https://github.com/rcongiu/Hive-JSON-Serde/blob/develop/json-serde/src/main/java/org/openx/data/jsonserde/JsonSerDe.java#L296-L326 . Then, default value 'null' is used for TIMESTAMP columns.

rcongiu commented 9 years ago

@bigwheel is right, timestamp is missing in serialization. I just pushed a fix in the development branch, have a look. I did a brief test and it looks like it's working: {"b":"2014-09-16 12:13:14","a":3}

dennyriadi commented 8 years ago

@appanasatya I came across the same issue recently and here is the PR for it https://github.com/rcongiu/Hive-JSON-Serde/pull/143. Hopefully @rcongiu will have time to review it.

rcongiu commented 7 years ago

I did merge it and it should be working. Closing, reopen if you still have the issue.