You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by kiranprasad <ki...@imimobile.com> on 2011/10/13 12:22:36 UTC

Can I use two methods while STORING the output.

HI 

Can I use 2 methods while STORING the output, If yes how?

Ex:
REGISTER contrib/piggybank/java/piggybank.jar;
A= LOAD 'E:/data/June_PAG_Sample.txt' USING PigStorage('|');
B = GROUP A BY $3;
C= FOREACH B GENERATE FLATTEN(A);
D= FOREACH B GENERATE group;
STORE USING
org.apache.pig.piggybank.storage.MultiStorage('E:/PIGOUTPUT/SL','3', 'none') 
org.apache.pig.piggybank.storage.PigStorageSchema()

Regards
Kiran.G

Re: Can I use two methods while STORING the output.

Posted by Gianmarco De Francisci Morales <gd...@apache.org>.
You can issue two different STORE commands with the two different
parameters.
STORE D
USING org.apache.pig.piggybank.storage.MultiStorage('E:/PIGOUTPUT/SL','3',
'none')
STORE D USING org.apache.pig.piggybank.storage.PigStorageSchema()

I think you are also missing an INTO <filename>

Cheers,
--
Gianmarco De Francisci Morales



On Thu, Oct 13, 2011 at 12:22, kiranprasad <ki...@imimobile.com>wrote:

> HI
>
> Can I use 2 methods while STORING the output, If yes how?
>
> Ex:
> REGISTER contrib/piggybank/java/piggybank.jar;
> A= LOAD 'E:/data/June_PAG_Sample.txt' USING PigStorage('|');
> B = GROUP A BY $3;
> C= FOREACH B GENERATE FLATTEN(A);
> D= FOREACH B GENERATE group;
> STORE USING
> org.apache.pig.piggybank.storage.MultiStorage('E:/PIGOUTPUT/SL','3',
> 'none')
> org.apache.pig.piggybank.storage.PigStorageSchema()
>
> Regards
> Kiran.G

Re: Can I use two methods while STORING the output.

Posted by Dmitriy Ryaboy <dv...@gmail.com>.
That doesn't really make sense, much like it doesn't say to store the same
file as both a pdf and a word file simultaneously. you only get 1 format for
1 file. You can make two copies, of course, but that's not what you are
after here.

What you probably want to do is modify MultiStorage to implement
StoreMetadata via JsonSchema (which is what PigStorageSchema does).

D

On Thu, Oct 13, 2011 at 3:22 AM, kiranprasad <ki...@imimobile.com>wrote:

> HI
>
> Can I use 2 methods while STORING the output, If yes how?
>
> Ex:
> REGISTER contrib/piggybank/java/piggybank.jar;
> A= LOAD 'E:/data/June_PAG_Sample.txt' USING PigStorage('|');
> B = GROUP A BY $3;
> C= FOREACH B GENERATE FLATTEN(A);
> D= FOREACH B GENERATE group;
> STORE USING
> org.apache.pig.piggybank.storage.MultiStorage('E:/PIGOUTPUT/SL','3',
> 'none')
> org.apache.pig.piggybank.storage.PigStorageSchema()
>
> Regards
> Kiran.G