You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Siddhi Mehta <sm...@gmail.com> on 2013/09/16 23:22:25 UTC

Pig Parameter Substitution

Hey All,


How does pig deal with handling null param values.
Should there be an exception on null param value?
Currently it just translates it to String null

e.g

        InputStream queryStream = IOUtils.toInputStream("A = LOAD '$VAL'
using PigStorage()", "UTF-8");
        Map<String, String> paramMap = Maps.newHashMap();
        paramMap.put("PARAM", null);
        try {
            pigServer.registerScript(queryStream, paramMap);
            fail();
        } catch (Exception e) {
            // should come here
        }

Instead currently it  the load source as [file:///home/user/null]

Thanks,
Siddhi

Re: Pig Parameter Substitution

Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Hi,

No sure whether it helps, but I did a lot of testing in such cases. "Test
and see" was my main approach. It is really tricky sometimes. Also you can
try the -dryrun option when launching pig.

Best Regards,
Ruslan Al-Fakikh
https://www.odesk.com/users/~015b7b5f617eb89923


On Tue, Sep 17, 2013 at 1:22 AM, Siddhi Mehta <sm...@gmail.com> wrote:

> Hey All,
>
>
> How does pig deal with handling null param values.
> Should there be an exception on null param value?
> Currently it just translates it to String null
>
> e.g
>
>         InputStream queryStream = IOUtils.toInputStream("A = LOAD '$VAL'
> using PigStorage()", "UTF-8");
>         Map<String, String> paramMap = Maps.newHashMap();
>         paramMap.put("PARAM", null);
>         try {
>             pigServer.registerScript(queryStream, paramMap);
>             fail();
>         } catch (Exception e) {
>             // should come here
>         }
>
> Instead currently it  the load source as [file:///home/user/null]
>
> Thanks,
> Siddhi
>