Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the becustom domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home4/joyplace/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home4/joyplace/public_html/wp-includes/functions.php on line 6114

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home4/joyplace/public_html/wp-includes/functions.php:6114) in /home4/joyplace/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":624,"date":"2015-12-20T05:03:18","date_gmt":"2015-12-20T11:03:18","guid":{"rendered":"https:\/\/www.bigdatainrealworld.com\/?p=624"},"modified":"2023-03-29T07:36:08","modified_gmt":"2023-03-29T12:36:08","slug":"beginners-apache-pig-tutorial-executing-as-a-script","status":"publish","type":"post","link":"https:\/\/www.bigdatainrealworld.com\/beginners-apache-pig-tutorial-executing-as-a-script\/","title":{"rendered":"Apache Pig Tutorial – Executing as a Script"},"content":{"rendered":"

Apache Pig Tutorial – Executing as a Script<\/h1>\n

Goal of this tutorial is to learn Apache Pig concepts in a fast pace. So don\u2019t except lengthy posts. All posts will be short and sweet. Most posts will have (very short) \u201csee it in action\u201d video.<\/strong><\/span><\/p>\n

So far in a series of lessons we saw step by step how to calculate average volume for stocks and along the way we learnt several key operators in Apache Pig. In this lesson we will see how to run pig instructions as a script.<\/p>\n

DUMP vs. STORE<\/h2>\n

DUMP operator is used to display or print data on the screen but more often than not we would like to store the results in HDFS. STORE operator is used to store the results in HDFS.<\/p>\n

With store we can also specify what delimiter to use when we store the results. In the below example we are instructions Pig to store the records from top10 <\/span>\u00a0relation in to output\/pig\/avg-volume<\/span>\u00a0\u00a0in HDFS and the column delimiter will be specified using the PigStorage <\/span>\u00a0function. In this case the columns will be delimited by comma.<\/p>\n

grunt> top10 = LIMIT avg_vol_ordered 10;\ngrunt> STORE top10 INTO 'output\/pig\/avg-volume' USING PigStorage(',');<\/pre>\n

Running Instructions as a Script<\/h2>\n

Running a series of pig instructions is very simple. Simply save the instructions in a file. The file extension – .pig is not mandatory but more of a convention. Execute the file like below<\/p>\n

pig \/hirw-workshop\/pig\/scripts\/average-volume.pig<\/pre>\n

\u00a0See It In Action<\/h2>\n