pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dai (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIG-2165) Need a way to deal with params and param_file in embedded pig in python
Date Mon, 24 Oct 2011 21:46:32 GMT

    [ https://issues.apache.org/jira/browse/PIG-2165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13134533#comment-13134533
] 

Daniel Dai commented on PIG-2165:
---------------------------------

Hi, Julien, 
PIG-2165-1.patch does use global variable PigContext.params to pass params. What it does is:
1. Put params into PigContext.params when processing command line
2. Adding PigContext.params to do variable binding:
{code}
        // plist is the variable array to bind
        if (getScriptContext().getPigContext().getParams()!=null) {
            for (String param : getScriptContext().getPigContext().getParams()) {
                plist.add(param);
            }
        }
        // Use plist to do the binding
{code}
3. For param_file, instead of reading and put into params, I delegate it to ParameterSubstitutionPreprocessor,
which already handles parameter_file:
{code}
    psp.genSubstitutedFile(in, writer, plist.toArray(params), scriptContext.getPigContext().getParamFiles().toArray(type1));
{code}
4. I also did some refactory in main() to use PigContext.params
                
> Need a way to deal with params and param_file in embedded pig in python
> -----------------------------------------------------------------------
>
>                 Key: PIG-2165
>                 URL: https://issues.apache.org/jira/browse/PIG-2165
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.9.0
>            Reporter: Supreeth
>            Assignee: Daniel Dai
>             Fix For: 0.10
>
>         Attachments: PIG-2165-1.patch
>
>
> I am using embedded pig in python and cannot pass param key value pairs to the python
script. The only way to pass params  seem to be by passing it in the bind command.
> Is there a plan to have command line parameters to a pig embedded python script? Similar
needs for param_file and using the environment variables.
> Thanks
> Supreeth

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message