String concatenation doesn't work in the pig

I have a table in hcatalog that has 3 string columns. When I try to concatenate a string, I get 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;

      

Failed to resolve concat using import: [, java.lang., Org.apache.pig.builtin., Org.apache.pig.impl.builtin.]

It is not possible to derive a match function for org.apache.pig.builtin.CONCAT as multiple, or none of them match. Use an explicit listing

What could be the root cause of the problem?

+3


source to share


1 answer


Maybe this will help concatenation in pigs

data1 contain:

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

      

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



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

      

O / P for X:

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

      

0


source







All Articles