Reputation: 11
Here is my question: I wonder know how to load these data:
Input data:
18 (John, Mary)
22 (Austin, Sunny)
78 (Richard, Alice)
87 (Johnny,)
And I want load these data to the variable A
So I write this:
A = Load 'data' AS (age:int, couple:(husband:chararray, wife:chararray));
But when I Dumped A the result give me like this:
(,)
(,)
(,)
(,)
But I wanna like this:
(18,(John, Mary))
(22,(Austin, Sunny))
(78,(Richard, Alice))
(87,(Johnny,))
How can I fix it?
Upvotes: 0
Views: 221
Reputation: 677
See here: In Pig latin, am not able to load data as multiple tuples, please advice
It's probably worth just having a plain CSV with individual columns. Then you can load in like:
A = LOAD data USING PigStorage(',') AS (age:int, person1:chararray, person2:chararray);
B = FOREACH A GENERATE *, (person1, person2) AS couple:tuple(person1:chararray, person2:chararray);
Could try changing your load in statement to:
A = Load 'data' AS (age:int, couple:tuple(husband:chararray, wife:chararray));
Where you're explicitly saying that you want to load in data as a tuple.
Upvotes: 1