Skip to content

Instantly share code, notes, and snippets.

@infectious
Created August 14, 2013 13:37
Show Gist options
  • Save infectious/6231152 to your computer and use it in GitHub Desktop.
Save infectious/6231152 to your computer and use it in GitHub Desktop.
Piggybank ISOToUnix
register /home/hadoop/.versions/pig-0.11.1.1/lib/pig/piggybank-0.11.1.1-amzn.jar;
define ISOToUnix org.apache.pig.piggybank.evaluation.datetime.convert.ISOToUnix();
data = load 'data_file.txt' using PigStorage('\t') as (user_id:int, datetime:chararray);
data = limit data 10000;
pdata = foreach generate
user_id,
ISOToUnix(datetime) / 1000 as timestamp:long;
dump pdata;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment