date - Hive not detecting timestamp format -
i have pig script
- loads , transforms data csv
- replaces characters
calls java program (jar) convert date-time in csv 06/02/2015 18:52 2015-6-2 18:52 (mm/dd/yyyy yyyy-mm-dd)
register /home/cloudera/datetime.jar; = load '/user/cloudera/data.csv' using pigstorage(',') (ac,datetime,amt,trace); b = foreach generate ac, replace(datetime, '\\/','-') newdate,replace(amt,'-','') newamt,trace; c = foreach b generate ac,converter.datetime(newdate) convdate,convamt,trace; store c '/user/cloudera/output/' using pigstorage('\t');
sample input -- 21467245 06/02/2015 18:52 -9.59 518
sample output -- 21467245 2015-6-2 18:52 9.59 518
i loading output hive, other fields seem fine during import, date-time field results null if loaded timestamp , intact when string.
where going wrong?
am using cloudera cdh 5
from the hive docs:
timestamps in text files have use format yyyy-mm-dd hh:mm:ss[.f...]. if in format declare them appropriate type (int, float, string, etc.) , use udf convert them timestamps.
so need either change converter
output format, or use udf --- or keep them strings, !
Comments
Post a Comment