You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Leon Town <le...@gmail.com> on 2012/12/31 09:26:30 UTC

How can I load these data as "bag"?

Dear Piggers,
I have some data on disk.

The data's form is like:
v1         {(a1,b1,c1),(a2,b2,c3),...,(a4,b4,c4)}
v2         {(a1,b1,c1),(a2,b2,c3),...,(a9,b9,c9)}

How can I load the data and set the second column's schema as *bag*?

Thanks!

Re: How can I load these data as "bag"?

Posted by Leon Town <le...@gmail.com>.
But, the number of items in column 2 is *varying*.
Can I load them as bag?


2012/12/31 Russell Jurney <ru...@gmail.com>

> This isn't well documented, but here's from RAM:
>
> a = load 'my.data' as id:chararray, stuff:bag{thing:tuple(field1,
> field2, field3)};
>
> Don't forget to set the types on the fieldNs.
>
> Russell Jurney http://datasyndrome.com
>
> On Dec 31, 2012, at 12:27 AM, Leon Town <le...@gmail.com> wrote:
>
> > Dear Piggers,
> > I have some data on disk.
> >
> > The data's form is like:
> > v1         {(a1,b1,c1),(a2,b2,c3),...,(a4,b4,c4)}
> > v2         {(a1,b1,c1),(a2,b2,c3),...,(a9,b9,c9)}
> >
> > How can I load the data and set the second column's schema as *bag*?
> >
> > Thanks!
>

Re: How can I load these data as "bag"?

Posted by Russell Jurney <ru...@gmail.com>.
This isn't well documented, but here's from RAM:

a = load 'my.data' as id:chararray, stuff:bag{thing:tuple(field1,
field2, field3)};

Don't forget to set the types on the fieldNs.

Russell Jurney http://datasyndrome.com

On Dec 31, 2012, at 12:27 AM, Leon Town <le...@gmail.com> wrote:

> Dear Piggers,
> I have some data on disk.
>
> The data's form is like:
> v1         {(a1,b1,c1),(a2,b2,c3),...,(a4,b4,c4)}
> v2         {(a1,b1,c1),(a2,b2,c3),...,(a9,b9,c9)}
>
> How can I load the data and set the second column's schema as *bag*?
>
> Thanks!