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":628,"date":"2015-12-20T06:59:07","date_gmt":"2015-12-20T12:59:07","guid":{"rendered":"https:\/\/www.bigdatainrealworld.com\/?p=628"},"modified":"2023-03-29T07:34:06","modified_gmt":"2023-03-29T12:34:06","slug":"beginners-apache-pig-tutorial-executing-script-with-parameters","status":"publish","type":"post","link":"https:\/\/www.bigdatainrealworld.com\/beginners-apache-pig-tutorial-executing-script-with-parameters\/","title":{"rendered":"Apache Pig Tutorial – Executing Script with Parameters"},"content":{"rendered":"

Apache Pig Tutorial – Executing\u00a0Script with Parameters<\/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

In the previous post<\/a>, we saw how to run Pig Latin instructions as a script. But there is one problem with that; we hard coded the Input and the Output location and it is not ideal. In this lesson we will see how we can pass parameters to the script.<\/p>\n

Parameter Placeholders<\/h2>\n

Take a look at the below sample. ‘$input’ is a parameter which defines the input location and ‘$output’ is a parameter which defines the output location.<\/p>\n

prices = LOAD '$input' USING PigStorage(',') as (exchange:chararray, symbol:chararray, date:datetime, open:float, high:float, low:float, close:float,volume:int, adj_close:float);<\/pre>\n
STORE top10 INTO '$output' USING PigStorage(',');<\/pre>\n

Passing Parameters<\/h2>\n

Now we know how to set the parameters, let’s see how to pass parameters from the command line. Use -param<\/span>\u00a0\u00a0and the parameter name to set and pass the value for the paramaters. In the below sample, at run time the value of the $input<\/span>\u00a0\u00a0in the script will be substituted as\u00a0\/user\/hirw\/input\/stocks<\/span><\/p>\n

pig -param input=\/user\/hirw\/input\/stocks -param output=output\/pig\/avg-volume-params \/hirw-workshop\/pig\/scripts\/average-volume-parameters.pig<\/pre>\n

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