TamizhK
TamizhK

Reputation: 448

Pig - Not loading the data

input data:

(10,1,{(2,3),(4,6)})
(10,3,{(2,3),(4,6)})
(10,6,{(2,3),(4,6),(5,7)})

Pig query:

x= load '/data.txt' as (d1:int, d2:int, B:bag{T:tuple(t1:int, t2:int)});

But I am getting the Output like:

(,,)
(,,)
(,,)
(,,)

I am not sure where am I making mistake.

Upvotes: 0

Views: 86

Answers (1)

ninja123
ninja123

Reputation: 200

Your data is enclosed by braces which means it's a tuple. You have to define a outer structure to consider the data as a tuple and then place your fields.

Here is what you need:

x= load '/data.txt' as (a:tuple(d1:int, d2:int, B:bag{T:tuple(t1:int, t2:int)}));

Upvotes: 1

Related Questions