Parameterise generated pig script

8 views
Skip to first unread message

Punit Naik

unread,
Mar 28, 2016, 7:55:57 AM3/28/16
to PigPen Support
I wanted to pass arguments to the generated pig script. One lame way to do this is to again and again generate the script by passing arguments to the clojure functions.

But I wanted to create a generic script to which I can directly pass the arguments. I can do this by including the -p option while running the script and then passing the argument as a key-value pair.

But how do I refer this in the clojure code?

Matt Bossenbroek

unread,
Mar 28, 2016, 11:56:36 AM3/28/16
to Punit Naik, PigPen Support
Pig arguments are defined using a dollar sign, like $VAR. In the past, I’ve used either strings:

(pig/load-tsv "$INPUT")

or vars:

(pig/map (fn [x] (+ x '$VALUE)))

to get parameters into the generated script.


-Matt

--
You received this message because you are subscribed to the Google Groups "PigPen Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pigpen-suppor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Punit Naik

unread,
Mar 28, 2016, 2:08:24 PM3/28/16
to PigPen Support, naik.p...@gmail.com
Thanks a lot Matt again for solving my doubt (Y)
Reply all
Reply to author
Forward
0 new messages