date - Pig ToDate casting error -


i have date field trying cast 'todate' via dates this

2015-03-28@18:21:18.  todate(replace(replace(date_time, '@', ' '),'.',''),'yyyy-mm-dd hh:mm:ss') 

the job dies , gives me error; backend error : invalid format: ""

i have filters take care of null values, size > 0 blanks.

return type of todate function datetime object. need not replace @, . characters '' (space).

ref : http://pig.apache.org/docs/r0.12.0/func.html#to-date, details

input : a.csv

 2015-03-28@18:21:18. 

pig scirpt :

  = load 'a.csv' (datevalue:chararray);   b = foreach generate todate(datevalue,'yyyy-mm-dd@hh:mm:ss.');   dump b;  

output :

    (2015-03-28t18:21:18.000-07:00) 

we have overloaded todate function, can specify timezone.

for eg : specifying timezone gmt

  b = foreach generate todate(datevalue,'yyyy-mm-dd@hh:mm:ss.','gmt');   dump b; 

output 2:

 (2015-03-28t18:21:18.000z)  

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -