Execute Pig Script from Grunt Shell

+1 vote
If i want to execute pig script from grunt shell what all do I need to have ?I have copied the
.pig file and source file into the hdfs. what else do i need to copy. Can you please share
the execution command or statement along with step by step process how to execute the
pig script in grunt shell?
Jan 9, 2018 in Big Data Hadoop by Sudhir Kumar
5,654 views

2 answers to this question.

0 votes

You can use exec or run command to execute the pig script using the grunt shell. In case of run command, all the commands present in script file will be available in the grunt history, which is not the case with exec command.

First you need to go ahead and load the data file in PigStorage. 

product = LOAD 'hdfs://localhost:9000/product_dir/products.csv' USING PigStorage(',') as (product_id:int, product_name:chararray, price:int);
dump product;

Next you can go ahead and execute the script file, which is stored in HDFS.

exec hdfs://localhost:9000/script_dir/pig_script.pig
or
run hdfs://localhost:9000/script_dir/pig_script.pig

answered Jun 20, 2018 by code_name
0 votes

From your current directory run 

pig -x local

Then grunt shell is invoked. Now, you can directly type your command here to execute it

answered Oct 25, 2018 by Kunal
Hi.. I tried this but i get not recognized error. Help me please

Make sure you have set the path to the pig.jar file. something like this:

export PIG_CLASSPATH=./pig.jar
Thanks. Now it works

Related Questions In Big Data Hadoop

0 votes
1 answer

How to execute Pig script from HDFS?

Hey, You can do something like executes a Pig ...READ MORE

answered Jun 26, 2019 in Big Data Hadoop by Gitika
• 65,910 points
863 views
0 votes
1 answer

Failing to execute the script pig file on HDFS

By convention, the pig script that you ...READ MORE

answered Feb 15, 2019 in Big Data Hadoop by John
589 views
0 votes
1 answer

how to execute pig script in MapReduce mode?

Hey, To execute pig script we can use ...READ MORE

answered May 8, 2019 in Big Data Hadoop by Gitika
• 65,910 points
1,039 views
0 votes
1 answer

Execute the Pig script in Local mode.

Hi@akhtar, You can write an entire Pig Latin ...READ MORE

answered Oct 14, 2020 in Big Data Hadoop by MD
• 95,440 points
311 views
0 votes
1 answer

What is grunt shell in pig?

Hey, Grunt shell is a shell command.The Grunts ...READ MORE

answered May 6, 2019 in Big Data Hadoop by Gitika
• 65,910 points
4,821 views
0 votes
1 answer

How to start Grunt shell in Local mode in Pig?

Hi@akhtar, You can invoke the Grunt shell in ...READ MORE

answered Oct 14, 2020 in Big Data Hadoop by MD
• 95,440 points
839 views
0 votes
1 answer
0 votes
1 answer

How to stop messages from being displayed on spark console?

In your log4j.properties file you need to ...READ MORE

answered Apr 24, 2018 in Apache Spark by kurt_cobain
• 9,390 points
5,009 views
0 votes
1 answer

Error while copying the file from local to HDFS

Well, the reason you are getting such ...READ MORE

answered May 3, 2018 in Big Data Hadoop by Ashish
• 2,650 points
3,673 views
0 votes
1 answer

Cannot connect to Hive from MicroStrategy BI tool

The problem is with your hive authentication. ...READ MORE

answered May 8, 2018 in Big Data Hadoop by Shubham
• 13,490 points
995 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP