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
1,024 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 in Big Data Hadoop by Gitika
• 25,420 points
32 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 14 in Big Data Hadoop by John
80 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 7 in Big Data Hadoop by Gitika
• 25,420 points
94 views
0 votes
1 answer

How to execute python script in hadoop file system (hdfs)?

If you are simply looking to distribute ...READ MORE

answered Sep 19, 2018 in Big Data Hadoop by digger
• 26,600 points
2,664 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 in Big Data Hadoop by Gitika
• 25,420 points
85 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,280 points
1,434 views
0 votes
1 answer

How to get Spark dataset metadata?

There are a bunch of functions that ...READ MORE

answered Apr 26, 2018 in Apache Spark by kurt_cobain
• 9,280 points
503 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 2, 2018 in Big Data Hadoop by Ashish
• 2,630 points
607 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,350 points
222 views