|
|
-
How to CONCAT multiple expressions
Cdy Chen 2012-07-10, 14:04
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
-
Re: How to CONCAT multiple expressions
Haitao Yao 2012-07-10, 14:41
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
-
Re: How to CONCAT multiple expressions
Cdy Chen 2012-07-11, 00:33
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 > >
-
Re: How to CONCAT multiple expressions
Russell Jurney 2012-07-11, 01:27
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 >> >>
-
Re: How to CONCAT multiple expressions
Scott Foster 2012-07-12, 01:23
StringConcat should work:
key = StringConcat((chararray)product.$1,(chararray)$7,(chararray)$6);
scott.
On Tue, Jul 10, 2012 at 6:27 PM, Russell Jurney <[EMAIL PROTECTED]> wrote: > 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 >>> >>>
-
Re: How to CONCAT multiple expressions
Dan Young 2012-07-12, 02:14
Try org.apache.pig.builtin.StringConcat
Dano On Tuesday, July 10, 2012, Cdy Chen wrote:
> 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 >
-
RE: How to CONCAT multiple expressions
Marek Miglinski 2012-07-12, 11:29
Try MassCONCAT: http://codeupload.com/4992Marek Miglinski ________________________________________ From: Dan Young [[EMAIL PROTECTED]] Sent: Thursday, July 12, 2012 5:14 AM To: [EMAIL PROTECTED] Subject: Re: How to CONCAT multiple expressions Try org.apache.pig.builtin.StringConcat Dano On Tuesday, July 10, 2012, Cdy Chen wrote: > 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 >
-
Re: How to CONCAT multiple expressions
Cdy Chen 2012-07-17, 13:27
Thanks all of you! 2012/7/12 Marek Miglinski <[EMAIL PROTECTED]> > Try MassCONCAT: > http://codeupload.com/4992> > > Marek Miglinski > ________________________________________ > From: Dan Young [[EMAIL PROTECTED]] > Sent: Thursday, July 12, 2012 5:14 AM > To: [EMAIL PROTECTED] > Subject: Re: How to CONCAT multiple expressions > > Try org.apache.pig.builtin.StringConcat > > Dano > > > On Tuesday, July 10, 2012, Cdy Chen wrote: > > > 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 > > >
|
|