3
votes

I have a table in hcatalog which has 3 string columns. When I try to concatenate string, I am getting the following error:

A = LOAD 'default.temp_table_tower' USING org.apache.hcatalog.pig.HCatLoader() ;
B = LOAD 'default.cdr_data' USING org.apache.hcatalog.pig.HCatLoader();
c = FOREACH A GENERATE CONCAT(mcc,'-',mnc) as newCid;

Could not resolve concat using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]

Could not infer the matching function for org.apache.pig.builtin.CONCAT as multiple or none of them fit. Please use an explicit cast

What might be the root cause of the problem?

1
What version of Pig do U use? Because CONCAT with more than two arguments is availiable in version 0.13. In previous versions you have to use CONCTAT(CONCAT(mcc,'-'),mnc) - psmith
Reference of CONCAT, which supports more than two arguments and CONCATwhich does not support multiple arguments - vishnu viswanath

1 Answers

0
votes

May be it will help for concatenation in pig

data1 contain:

(Maths,abc)
(Maths,def)
(Maths,ef)
(Maths,abc)
(Science,ac)
(Science,bc)
(Chemistry,xc)
(Telugu,xyz)

considering schema as sub:Maths,Maths,Science....etc and name :abc,def ,ef..etc

X = FOREACH data1 GENERATE CONCAT(sub,CONCAT('@',name));

O/P of X is:

(Maths@abc)
(Maths@def)
(Maths@ef)
(Maths@abc)
(Science@ac)
(Science@bc)
(Chemistry@xc)
(Telugu@xyz)