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
478 views

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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

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
62 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
• 8,620 points
9 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
• 27,620 points
845 views
0 votes
1 answer

Hadoop: "DEPRECATED: Use of this script to execute hdfs command is deprecated." error

The use of dfs in your command is "Deprecated". ...READ MORE

answered Nov 26, 2018 in Big Data Hadoop by Omkar
• 66,050 points
370 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
• 8,620 points
12 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,260 points
629 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,260 points
183 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
245 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
• 12,270 points
112 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.