If you know before you start the script which you want, you can use
parameter substitution:
A = load 'foo';
...
Z = foreach Y generate ...;
$DO_OUTPUT
Then, depending on which you want, run pig with
pig -pDO_OUTPUT='dump Z;';
or
pig -pDO_OUTPUT="store Z into 'outfile';"
If you want to decide which to do based on results of the script, then
you'll need the new control flow integration features available in
0.9. These aren't yet released, but they are in trunk.
Alan.
On Mar 14, 2011, at 10:40 PM, Andreas Paepcke wrote:
I want to do something really simple: I want to pass a string
into a Pig script. The string is either "stdout" or some target
file name. Say the string gets bound to $OUTPUT. That all
works fine.
After the script has computed a result R, depending on the
value of $OUTPUT, I want either to do a dump R (if
$OUTPUT == "stdout"), or a STORE of R into the given
file name that's held in $OUTPUT.
How do I do that conditional? I played with bincond, but
got stuck.
Thanks!
Andreas
Andreas