Yet Another Blog in Statistical Computing

I can calculate the motion of heavenly bodies but not the madness of people. -Isaac Newton

Test Drive of PiggyBank

REGISTER /home/liuwensui/pig/lib/piggybank.jar;

DEFINE CSVLoader org.apache.pig.piggybank.storage.CSVLoader;

a = LOAD '/home/liuwensui/Downloads/2008.csv2' USING CSVLoader();

b = FOREACH a GENERATE $8 as x;

c = LIMIT b 4;

dump c;

/*
(WN)
(WN)
(WN)
(WN)
*/

DEFINE L org.apache.pig.piggybank.evaluation.string.LOWER;

DEFINE R org.apache.pig.piggybank.evaluation.string.REPLACE;

d = FOREACH c GENERATE x, L(x), R(x, 'WN', 'WW');

dump d;

/*
(WN,wn,WW)
(WN,wn,WW)
(WN,wn,WW)
(WN,wn,WW)
*/
Advertisements

Written by statcompute

September 23, 2014 at 10:27 pm

Posted in Pig Latin

Tagged with ,

%d bloggers like this: