Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

[main] ERROR org.apache.pig.tools.grunt.Grunt

avatar

This is my script and i have also a table called riskfactor in Hive . 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(); When i execute this pig script it shows me that error and not saving any data. I did step by step everything it says here : https://hortonworks.com/hadoop-tutorial/hello-world-an-introduction-to-hadoop-hcatalog-hive-and-pig/...

1 ACCEPTED SOLUTION

avatar
Expert Contributor

hello @voca voca ,

I ran into the same problem but realized that the totalmiles column within Hive should be a Double Column and not an INT as described in the tutorial.

So if you take this block of code below and rerun in hive view. It should work for you.

drop table riskfactor; 
CREATE TABLE riskfactor (driverid string,events bigint,totmiles double,riskfactor float)
STORED AS ORC;

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

hello @voca voca ,

I ran into the same problem but realized that the totalmiles column within Hive should be a Double Column and not an INT as described in the tutorial.

So if you take this block of code below and rerun in hive view. It should work for you.

drop table riskfactor; 
CREATE TABLE riskfactor (driverid string,events bigint,totmiles double,riskfactor float)
STORED AS ORC;

avatar
Expert Contributor

Once you recreate the hive table try to rerun your Pig script. Inside the pig script don't forget to add the argument -useHCatalog.....

avatar

such a compiler !