It's not the prettiest thing, but:

FOREACH file GENERATE CONCAT(CONCAT(  CONCAT(house, ' '),
CONCAT(predir, ' ')), street)

(and so on)

A better solution would be to write a UDF that wraps StringBuilder,
and simply call

GENERATE StringBuilder(house, ' ', predir, ' ', street ....);

-D

On Wed, May 12, 2010 at 3:59 PM, Scott Wine <[email protected]> wrote:
> Hello,
>
> I am trying to create a full address and full location field in Pig by 
> combining multiple fields.
>
> file = LOAD 'file.txt' USING PigStorage() AS
>  (house:chararray,
>  predir:chararray,
>  street:chararray,
>  streettype:chararray,
>  postdir:chararray
>  city:chararray,
>  state:chararray,
>  zip:chararray)
>
> I need an output that is full address and full location:
>
> full_address == house + ' ' + predir + ' ' + street + ' ' + streettype + ' ' 
> + postdir
> full_location == city + ' ' + state + ' ' + zip
>
> I can get two to merge with CONCAT using but am not able to add more or the 
> spaces in between.
>
> Temp1 = FOREACH file GENERATE CONCAT (house,street)
>
> Any ideas?
>
> Thanks
> Scott
>
>
>

Reply via email to