That is because you're calling REPLACE on a bag of tuples and not a string.
What you would want to do is write a UDF (suggested name JOIN_ON), that
takes as an argument a join char and will join all the tuples in the bag by
the join char.


On Mon, Apr 7, 2014 at 12:31 PM, Krishnan Narayanan <
krishnan.sm...@gmail.com> wrote:

> Thanks Ankit,
>
> I am getting the desired result. What i did was I group by year but did not
> use any aggregate function so that the output is a bag(tuples).
> Now when I try to apply replace function for replacing the curly braces and
> brackets so that it will look 2014,2013 but it gives me error can't cast
> tuple to chararray.
> Cannot cast tuple with schema
>
> {(2014),(2013)}
>
>
> On Tue, Apr 1, 2014 at 5:47 PM, Ankit Bhatnagar <ank...@yahoo-inc.com
> >wrote:
>
> > Run a group by year field
> >
> > Then do whatever u want to do
> >
> > On 4/1/14 5:45 PM, "Krishnan Narayanan" <krishnan.sm...@gmail.com>
> wrote:
> >
> > >Hi All,
> > >
> > >Using Pig how can I achieve the below mentioned output from the input.
> > >
> > >Input
> > >
> > >year , 2000
> > >year , 2001
> > >year , 2002
> > >
> > >OutPut
> > >
> > >year 2000|2001|2002 ( in one row).
> > >
> > >Thanks
> > >Krishnan
> >
> >
>

Reply via email to