I am doing the tutorial labs and I’m having a problem with Pig (Lab 3: Pig – Risk Factor):
I am running “Hortonworks Sandbox with HDP 2.3″ using VirtualBox 4.3.30 on Ubuntu 14.04 LTS 64bit host.
When executing the following pig script:
a = LOAD ‘geolocation’ using org.apache.hive.hcatalog.pig.HCatLoader();
b = filter a by event != ‘normal';
c = foreach b generate driverid, event, (int) ‘1’ as occurance;
d = group c by driverid;
e = foreach d generate group as driverid, SUM(c.occurance) as t_occ;
g = LOAD ‘drivermileage’ using org.apache.hive.hcatalog.pig.HCatLoader();
h = join e by driverid, g by driverid;
final_data = foreach h generate $0 as driverid, $1 as events, $3 as totmiles, (float) $3/$1 as riskfactor;
store final_data into ‘riskfactor’ using org.apache.hive.hcatalog.pig.HCatStorer();
I get the following error:
ERROR org.apache.pig.PigServer – exception during parsing: Error during parsing. Could not resolve org.apache.hive.hcatalog.pig.HCatLoader using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]
Failed to parse: Pig script failed to parse:
<file script.pig, line 1, column 29> pig script failed to validate: org.apache.pig.backend.executionengine.ExecException: ERROR 1070: Could not resolve org.apache.hive.hcatalog.pig.HCatLoader using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.]
I’ve seen some related postings but all with much older versions of the Sandbox. I’ve the following with no success:
1. Login to sandbox as root.
2. Edit file /usr/bin/pig
3. Replace the last line with the following line:
exec /usr/lib/pig/bin/pig -useHCatalog “$@”
This may no longer apply as was posted in 2013.