You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by Jonathan Coveney <jc...@gmail.com> on 2012/07/11 05:32:02 UTC

Re: How to CONCAT multiple expressions

-user +dev

It'd be nice if we could have vararg typed udf's

2012/7/10 Russell Jurney <ru...@gmail.com>

> I really need to fix this in pig 0.11
>
> Russell Jurney
> twitter.com/rjurney
> russell.jurney@gmail.com
> datasyndrome.com
>
> On Jul 10, 2012, at 5:34 PM, Cdy Chen <do...@gmail.com> wrote:
>
> > Thank you !
> >
> > I use
> >
> > key2 = CONCAT($1,$6);
> > key = CONCAT(key2,$8);
> >
> > It also works!
> >
> > Regards,
> > Chen
> >
> > 2012/7/10 Haitao Yao <ya...@gmail.com>
> >
> >> like this:
> >>
> >> CONCAT(CONCAT('all', ':'), 'all')
> >>
> >> It's ugly ,  but the concat only accepts 2 parameters.
> >> Here's the java  doc of CONCAT class:
> >> /**
> >> * Generates the concatenation of the first two arguments.  It can be
> >> * used with two bytearrays or two chararrays (but not a mixture of the
> >> two).
> >> */
> >>
> >>
> >> Haitao Yao
> >> yao.erix@gmail.com
> >> weibo: @haitao_yao
> >> Skype:  haitao.yao.final
> >>
> >> 在 2012-7-10,下午10:04, Cdy Chen 写道:
> >>
> >>> Hi all,
> >>>
> >>> I am a new comer here. I encounter a problem toady:
> >>>
> >>> Pig version: 0.10.0
> >>>
> >>> temp2 = LOAD '/pig/procedure/tzone' USING PigStorage(';');
> >>> zone = FOREACH temp2
> >>> {
> >>>  a = STRSPLIT($0,'#',3);
> >>>  product = STRSPLIT(a.$1,'-',2);
> >>>  key = CONCAT((chararray)product.$1,(chararray)$7,(chararray)$6);
> >>>  GENERATE
> >>>
> >>
> key,product.$1,TRIM($10),TRIM($4),TRIM($7),TRIM($9),TRIM($8),TRIM($14),TRIM($1),TRIM($6);
> >>> };
> >>>
> >>> It still shows an error:
> >>> ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1045:
> >>> <line 21, column 9> Could not infer the matching function for
> >>> org.apache.pig.builtin.CONCAT as multiple or none of them fit. Please
> use
> >>> an explicit cast.
> >>>
> >>> Please help!
> >>>
> >>> Thanks!
> >>> Chen
> >>
> >>
>