Created 09-07-2016 08:32 PM
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.]
Created 09-08-2016 12:09 AM
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.
Created 09-08-2016 12:09 AM
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.
Created 09-08-2016 06:04 PM
That was it. Thanks.
Created 09-08-2016 06:10 PM
Glad I could help 🙂
Created 11-14-2023 08:42 PM
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
Created 11-15-2023 12:15 AM
@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,