How to display a declared variable in PIG
3 answers
You can name your script as a dry run using the following:
pig -x local -r my_pig_script.pig
Will be displayed my_pig_script.pig.substituted
in your working directory. If you look at this file, all declared variables will be replaced with their values. This gives you a "preview" of what your work will be doing before sending it to the cluster.
Hope this helps!
Edit:
Dry run will also help you debug your script and identify any compilation errors before actually running.
+1
source to share
The STORE statement writes output to the file system; or, the DUMP statement displays the output to the screen
A = LOAD 'student' USING PigStorage() AS (name:chararray, age:int, gpa:float);
B = FOREACH A GENERATE name;
DUMP B;
(John)
(Mary)
(Bill)
(Joe)
For more information: https://pig.apache.org/docs/r0.7.0/piglatin_ref1.html
0
source to share