Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Error 1070 when running Lab 3 - Pig Tutorial Script,While running Lab 3 I - Pig Risk Analysis - I get an error 1070.

avatar
New Contributor

Hi,

I get the following error when I try to run the Lab 3 - Pig tutorial

2016-09-07 20:06:51,165 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve sum using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]

,

Hi, the details of the error are:

2016-09-07 20:06:51,165 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve sum using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]

1 ACCEPTED SOLUTION

avatar
Guru

@D Srini

You have provided the error but not the code itself. Based on the error, it looks like your code did not use SUM in caps.

SUM is a built in function of pig. It is a java static method called SUM in the package org.apache.pig.builtin which is packaged in the pig jars. Bottom line is that this function is case sensitive.

I think instead of writing

e =foreach d generate groupas driverid, SUM(c.occurance)as t_occ;

you wrote

e =foreach d generate groupas driverid, sum(c.occurance)as t_occ;

See https://pig.apache.org/docs/r0.16.0/func.html#built-in-functions to learn more about pig functions, both builtin functions (where you do not need to register them in your code because pig dynamically finds the function in the pig jars) and user-defined functions (where you create the jar and register it in the pig code).

If this was indeed the problem, let me know by accepting the answer.

View solution in original post

5 REPLIES 5

avatar
Guru

@D Srini

You have provided the error but not the code itself. Based on the error, it looks like your code did not use SUM in caps.

SUM is a built in function of pig. It is a java static method called SUM in the package org.apache.pig.builtin which is packaged in the pig jars. Bottom line is that this function is case sensitive.

I think instead of writing

e =foreach d generate groupas driverid, SUM(c.occurance)as t_occ;

you wrote

e =foreach d generate groupas driverid, sum(c.occurance)as t_occ;

See https://pig.apache.org/docs/r0.16.0/func.html#built-in-functions to learn more about pig functions, both builtin functions (where you do not need to register them in your code because pig dynamically finds the function in the pig jars) and user-defined functions (where you create the jar and register it in the pig code).

If this was indeed the problem, let me know by accepting the answer.

avatar
New Contributor

That was it. Thanks.

avatar
Guru

Glad I could help 🙂

avatar
New Contributor

I am getting the same error when I use this 

correlation_coefficient = FOREACH (GROUP correlation_data ALL) GENERATE PiggyBank.COR(correlation_data.age, correlation_data.avg_glucose_level) AS correlation;

Error:
2023-11-15 10:02:09,087 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1070: Could not resolve PiggyBank.COR using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]

could you please help me out 

avatar
Community Manager

 

@harshavar666, Welcome to the Cloudera Community. As this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: