apache pig - PIG - STORING TEMPORARY VALUES -
data schema : sdesc:chararray,samt:init,syear:chararrary,stype:chararrary
data:
wrench 259000 2000 store wrench 135000 2000 online wrench 175000 2001 online wrench 180000 2001 store
script
ysales =load ‘salesdata.txt’ using pigstorage()as (sdesc:chararray,samt:init,syear:chararrary,stype:chararrary); basedata = filter ysales (sdesc==’wrench’) , (syear = ‘2000’ ) , (stype = ‘store);
my result set : dump basedata;
(wrench,259000,2000,store)
so question how break basedata have (for example) a = ‘wrench’ b = 259000, c=2000, d = ‘store’
you can use argument numbers extract values according columns
a = foreach basedata generate $0; b = foreach basedata generate $1; c = foreach basedata generate $2; d = foreach basedata generate $3;
Comments
Post a Comment