Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # dev >> Re: How to CONCAT multiple expressions


Copy link to this message
-
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 <[EMAIL PROTECTED]>

> I really need to fix this in pig 0.11
>
> Russell Jurney
> twitter.com/rjurney
> [EMAIL PROTECTED]
> datasyndrome.com
>
> On Jul 10, 2012, at 5:34 PM, Cdy Chen <[EMAIL PROTECTED]> wrote:
>
> > Thank you !
> >
> > I use
> >
> > key2 = CONCAT($1,$6);
> > key = CONCAT(key2,$8);
> >
> > It also works!
> >
> > Regards,
> > Chen
> >
> > 2012/7/10 Haitao Yao <[EMAIL PROTECTED]>
> >
> >> 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
> >> [EMAIL PROTECTED]
> >> 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
> >>
> >>
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB