You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Sachin Sudarshana <sa...@gmail.com> on 2013/04/24 12:17:00 UTC

Inserting a row from a file as a bag

Hi,

I have just started learning about Pig, and i had a task of importing a
line from a text file as a bag in pig.

The contents of my file were:
{(2,3)  (5,6,7,8)}
{(2,4)  (5,7,8,9)}
{(1,3)  (4,5,7,9)}
{(2,5)  (7,9,1,1)}
{(2,3)  (4,6,8,3)}


So, the command that is used to import this file as a bag was:

A = LOAD '<file_name>' USING PigStorage(' ') AS (B:Bag {(T: tuple(f1:int,
f2:int), F: tuple(f3:int, f4:int, f5:int, f6:int))});

When i do a DUMP A command, the result does not show any values.
A blank set of tuples are displayed.

I'm not sure if i'm doing something wrong ?
Any help would be greatly appreciated!

Thanks,
Sachin

Re: Inserting a row from a file as a bag

Posted by Sachin Sudarshana <sa...@gmail.com>.
Hi,

Yes the file is on HDFS..

Thanks,
sachin


On Wed, Apr 24, 2013 at 9:58 PM, centerqi hu <ce...@gmail.com> wrote:

> file_name is on hdfs?
>
>
> 2013/4/24 Sachin Sudarshana <sa...@gmail.com>
>
> > Hi,
> >
> > I have just started learning about Pig, and i had a task of importing a
> > line from a text file as a bag in pig.
> >
> > The contents of my file were:
> > {(2,3)  (5,6,7,8)}
> > {(2,4)  (5,7,8,9)}
> > {(1,3)  (4,5,7,9)}
> > {(2,5)  (7,9,1,1)}
> > {(2,3)  (4,6,8,3)}
> >
> >
> > So, the command that is used to import this file as a bag was:
> >
> > A = LOAD '<file_name>' USING PigStorage(' ') AS (B:Bag {(T: tuple(f1:int,
> > f2:int), F: tuple(f3:int, f4:int, f5:int, f6:int))});
> >
> > When i do a DUMP A command, the result does not show any values.
> > A blank set of tuples are displayed.
> >
> > I'm not sure if i'm doing something wrong ?
> > Any help would be greatly appreciated!
> >
> > Thanks,
> > Sachin
> >
>
>
>
> --
> centerqi@gmail.com|齐忠
>

Re: Inserting a row from a file as a bag

Posted by centerqi hu <ce...@gmail.com>.
file_name is on hdfs?


2013/4/24 Sachin Sudarshana <sa...@gmail.com>

> Hi,
>
> I have just started learning about Pig, and i had a task of importing a
> line from a text file as a bag in pig.
>
> The contents of my file were:
> {(2,3)  (5,6,7,8)}
> {(2,4)  (5,7,8,9)}
> {(1,3)  (4,5,7,9)}
> {(2,5)  (7,9,1,1)}
> {(2,3)  (4,6,8,3)}
>
>
> So, the command that is used to import this file as a bag was:
>
> A = LOAD '<file_name>' USING PigStorage(' ') AS (B:Bag {(T: tuple(f1:int,
> f2:int), F: tuple(f3:int, f4:int, f5:int, f6:int))});
>
> When i do a DUMP A command, the result does not show any values.
> A blank set of tuples are displayed.
>
> I'm not sure if i'm doing something wrong ?
> Any help would be greatly appreciated!
>
> Thanks,
> Sachin
>



-- 
centerqi@gmail.com|齐忠