You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Mark <st...@gmail.com> on 2010/09/16 02:04:43 UTC
Basic questions
Say I have a bunch of tuples that is a result of a GROUP, how can I
just store the values.. not the key?
As a side note, how can I output bags to be separated by tabs instead of
commas? How can I remove the annoying parentheses and brackets around my
output?
Thanks
Re: Basic questions
Posted by Jeff Zhang <zj...@gmail.com>.
well, then write an UDF to convert bag to string will work for me.
On Thu, Sep 16, 2010 at 8:32 AM, Mark <st...@gmail.com> wrote:
> So if I have a tuple that looks like:
>
> ({(163906653),(61482111),(157530223)})
>
> There is no way to get that to output as:
>
> 163906653/t61482111/t157530223
>
> ???
>
> On 9/15/10 5:19 PM, Olga Natkovich wrote:
>>
>> Hi Mark,
>>
>> Both PigStorage and BinStorage allow you to store complex types such as
>> bags. So you can do something like this:
>>
>> A = load 'mydata' as (x, y, z);
>> B = group A by x;
>> C = foreach B generate A;
>> store C;
>>
>> If you don't like the formatting done by the store function, you can
>> create a storage function that formats the data the way you like.
>>
>> Olga
>>
>> -----Original Message-----
>> From: Mark [mailto:static.void.dev@gmail.com]
>> Sent: Wednesday, September 15, 2010 5:05 PM
>> To: pig-user@hadoop.apache.org
>> Subject: Basic questions
>>
>> Say I have a bunch of tuples that is a result of a GROUP, how can I
>> just store the values.. not the key?
>>
>> As a side note, how can I output bags to be separated by tabs instead of
>> commas? How can I remove the annoying parentheses and brackets around my
>> output?
>>
>> Thanks
>>
>
--
Best Regards
Jeff Zhang
RE: Basic questions
Posted by Olga Natkovich <ol...@yahoo-inc.com>.
Not with standard storage functions that we have.
-----Original Message-----
From: Mark [mailto:static.void.dev@gmail.com]
Sent: Wednesday, September 15, 2010 5:33 PM
To: pig-user@hadoop.apache.org
Subject: Re: Basic questions
So if I have a tuple that looks like:
({(163906653),(61482111),(157530223)})
There is no way to get that to output as:
163906653/t61482111/t157530223
???
On 9/15/10 5:19 PM, Olga Natkovich wrote:
> Hi Mark,
>
> Both PigStorage and BinStorage allow you to store complex types such as bags. So you can do something like this:
>
> A = load 'mydata' as (x, y, z);
> B = group A by x;
> C = foreach B generate A;
> store C;
>
> If you don't like the formatting done by the store function, you can create a storage function that formats the data the way you like.
>
> Olga
>
> -----Original Message-----
> From: Mark [mailto:static.void.dev@gmail.com]
> Sent: Wednesday, September 15, 2010 5:05 PM
> To: pig-user@hadoop.apache.org
> Subject: Basic questions
>
> Say I have a bunch of tuples that is a result of a GROUP, how can I
> just store the values.. not the key?
>
> As a side note, how can I output bags to be separated by tabs instead of
> commas? How can I remove the annoying parentheses and brackets around my
> output?
>
> Thanks
>
Re: Basic questions
Posted by Mark <st...@gmail.com>.
So if I have a tuple that looks like:
({(163906653),(61482111),(157530223)})
There is no way to get that to output as:
163906653/t61482111/t157530223
???
On 9/15/10 5:19 PM, Olga Natkovich wrote:
> Hi Mark,
>
> Both PigStorage and BinStorage allow you to store complex types such as bags. So you can do something like this:
>
> A = load 'mydata' as (x, y, z);
> B = group A by x;
> C = foreach B generate A;
> store C;
>
> If you don't like the formatting done by the store function, you can create a storage function that formats the data the way you like.
>
> Olga
>
> -----Original Message-----
> From: Mark [mailto:static.void.dev@gmail.com]
> Sent: Wednesday, September 15, 2010 5:05 PM
> To: pig-user@hadoop.apache.org
> Subject: Basic questions
>
> Say I have a bunch of tuples that is a result of a GROUP, how can I
> just store the values.. not the key?
>
> As a side note, how can I output bags to be separated by tabs instead of
> commas? How can I remove the annoying parentheses and brackets around my
> output?
>
> Thanks
>
RE: Basic questions
Posted by Olga Natkovich <ol...@yahoo-inc.com>.
Hi Mark,
Both PigStorage and BinStorage allow you to store complex types such as bags. So you can do something like this:
A = load 'mydata' as (x, y, z);
B = group A by x;
C = foreach B generate A;
store C;
If you don't like the formatting done by the store function, you can create a storage function that formats the data the way you like.
Olga
-----Original Message-----
From: Mark [mailto:static.void.dev@gmail.com]
Sent: Wednesday, September 15, 2010 5:05 PM
To: pig-user@hadoop.apache.org
Subject: Basic questions
Say I have a bunch of tuples that is a result of a GROUP, how can I
just store the values.. not the key?
As a side note, how can I output bags to be separated by tabs instead of
commas? How can I remove the annoying parentheses and brackets around my
output?
Thanks