You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by soniya B <so...@gmail.com> on 2013/11/18 03:01:14 UTC

pass relation value to the file path of store command

Hi friends,

I have a sample script below

AA = ....
A= filter AA by ID = 2;
B= foreach A generate ID,name,description;
Store A into '/main/abc' ;


I want to store the ID value in the end of filepath. i.e  'main/abc/ID' .

here, i have to get filepath as '/main/abc/2' .

Could you please help me? if is not possible in pig latin then how to do it
in the shell script?

Thanks
Soniya

Re: pass relation value to the file path of store command

Posted by Serega Sheypak <se...@gmail.com>.
Maybe it's better to try bucketed hive table?
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL+BucketedTables


2013/11/18 Ruslan Al-Fakikh <me...@gmail.com>

> Hi soniya,
>
> In you example you are hard-coding the ID to 2 in your filter statement.
> You could also hard-code it in STORE:
> Store A into '/main/abc'/2 ;
> If you want to separate the rows by a value of a field then you could try
> MultiStorage from piggybank.
>
> Thanks
>
>
> On Mon, Nov 18, 2013 at 6:01 AM, soniya B <so...@gmail.com>
> wrote:
>
> > Hi friends,
> >
> > I have a sample script below
> >
> > AA = ....
> > A= filter AA by ID = 2;
> > B= foreach A generate ID,name,description;
> > Store A into '/main/abc' ;
> >
> >
> > I want to store the ID value in the end of filepath. i.e  'main/abc/ID' .
> >
> > here, i have to get filepath as '/main/abc/2' .
> >
> > Could you please help me? if is not possible in pig latin then how to do
> it
> > in the shell script?
> >
> > Thanks
> > Soniya
> >
>

Re: pass relation value to the file path of store command

Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Hi soniya,

In you example you are hard-coding the ID to 2 in your filter statement.
You could also hard-code it in STORE:
Store A into '/main/abc'/2 ;
If you want to separate the rows by a value of a field then you could try
MultiStorage from piggybank.

Thanks


On Mon, Nov 18, 2013 at 6:01 AM, soniya B <so...@gmail.com> wrote:

> Hi friends,
>
> I have a sample script below
>
> AA = ....
> A= filter AA by ID = 2;
> B= foreach A generate ID,name,description;
> Store A into '/main/abc' ;
>
>
> I want to store the ID value in the end of filepath. i.e  'main/abc/ID' .
>
> here, i have to get filepath as '/main/abc/2' .
>
> Could you please help me? if is not possible in pig latin then how to do it
> in the shell script?
>
> Thanks
> Soniya
>

Re: pass relation value to the file path of store command

Posted by Gaurav Pandit <pa...@gmail.com>.
Are you looking for MultiStorage instead of pigstorage?

See
http://pig.apache.org/docs/r0.10.0/api/org/apache/pig/piggybank/storage/MultiStorage.html
.

- Gaurav
On Nov 17, 2013 9:01 PM, "soniya B" <so...@gmail.com> wrote:

> Hi friends,
>
> I have a sample script below
>
> AA = ....
> A= filter AA by ID = 2;
> B= foreach A generate ID,name,description;
> Store A into '/main/abc' ;
>
>
> I want to store the ID value in the end of filepath. i.e  'main/abc/ID' .
>
> here, i have to get filepath as '/main/abc/2' .
>
> Could you please help me? if is not possible in pig latin then how to do it
> in the shell script?
>
> Thanks
> Soniya
>