You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Aida Mashkouri Najafi <ai...@infectiousmedia.com> on 2013/10/16 15:57:50 UTC

date formating

Hi,

I have a data set with a date format like below and I am trying to convert
it to ISO format.
I keep getting the error:  either Backend error : null or it dumps
completely empty brackets.
Could you please give me any suggestion on this?

Many thank,

This is the script I am running:
register /home/hadoop/pig/jars/piggybank.jar;


DEFINE ToISOFormat
org.apache.pig.piggybank.evaluation.datetime.convert.CustomFormatToISO();
DEFINE ISOToUnix
org.apache.pig.piggybank.evaluation.datetime.convert.ISOToUnix();


A = load '/tmp/data/sky/oct' using PigStorage(',') as (timestamp:chararray,
user_id:chararray);
R1 = FOREACH A GENERATE ToISOFormat(timestamp, 'MMM  d  YYYY  K:mm') as
unix_time:long;
DUMP R1;


(Oct  7 2013  8:19PM,927b622ef82742428e56bad1289c2c66)
(Oct  7 2013  8:19PM,9d759e2d2aac4f68968cbd3bb65d3316)
(Oct  7 2013  8:19PM,9e18c1d308314abfa730dc6606ac2ae4)
(Oct  7 2013  8:19PM,9e6df69b765b416688c205537b1f7e48)
(Oct  7 2013  8:19PM,9f6b69235a77406f98e87447b8627105)
(Oct  7 2013  8:19PM,b5f1c4b5710b4beebfeb7e6a02b9b1f6)
(Oct  7 2013  8:19PM,b9320f14fc984ab5a0343d1569f15317)




-- 

*Aida MASHKOURI NAJAFI*

DaTA SCIENTIST

T. +44(0) 20 7775 5625

*[image: Infectious Media]*

3-7 Herbal Hill / London / EC1R 5EJ

www.infectiousmedia.com


[image: Infectious Media] <http://www.infectiousmedia.com/>

[image: Facebook] <http://www.facebook.com/infectiousmedia>

[image: Twitter] <https://twitter.com/infectiousmedia>

[image: LinkedIn] <http://www.linkedin.com/company/infectious-media-ltd>

[image: Youtube] <http://www.youtube.com/user/InfectiousMediaLtd>