Created 03-01-2016 08:53 AM
Hi,
I was trying to load a file in Pig which contains data like :
{(3),(mary),(19)}
{(1),(john),(18)}
{(2),(joe),(18)}
Following command is falling :
A = LOAD 'data3' AS (B: bag {T: tuple(t1:int), F:tuple(f1:chararray), G:tuple(g1:int)});
How to do it in correct way ?
Thanks,
Soumya
Created 03-01-2016 09:42 AM
Want to get a detailed solution you have to login/registered on the community
Register/LoginCreated 03-01-2016 09:12 AM
Created 03-01-2016 09:42 AM
Want to get a detailed solution you have to login/registered on the community
Register/LoginCreated 03-01-2016 11:25 AM
Load the data using pig storage and then run tobag function http://pig.apache.org/docs/r0.15.0/func.html#tobag is it a comma separated file?
a = LOAD 'student' AS (f1:chararray, f2:int, f3:float); DUMP a; (John,18,4.0) (Mary,19,3.8) (Bill,20,3.9) (Joe,18,3.8) b = FOREACH a GENERATE TOBAG(f1,f3); DUMP b; ({(John),(4.0)}) ({(Mary),(3.8)}) ({(Bill),(3.9)}) ({(Joe),(3.8)})