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 Plain View
Pig >> mail # user >> How to CONCAT multiple expressions


+
Cdy Chen 2012-07-10, 14:04
+
Haitao Yao 2012-07-10, 14:41
+
Cdy Chen 2012-07-11, 00:33
Copy link to this message
-
Re: How to CONCAT multiple expressions
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
>>
>>
+
Scott Foster 2012-07-12, 01:23
+
Dan Young 2012-07-12, 02:14
+
Marek Miglinski 2012-07-12, 11:29
+
Cdy Chen 2012-07-17, 13:27
+
unmesha sreeveni 2014-05-02, 03:26
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