hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Chauhan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-598) Parameter substitution ($PARAMETER) should not be performed in comments
Date Mon, 23 Nov 2009 19:09:39 GMT

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

Ashutosh Chauhan commented on PIG-598:

I guess my question is what should be the behavior when $ is specified in the script and no
substitution for it is provided. There are two options: a) If Pig encounters a $ and doesn't
find a substitution for it, it fails right there. 
b) Pig logs a warning message and continue assuming user wants literal $ and not the substitution.

Advantage for b) is there will not be a need of escaping. Disadvantage is when no substitution
was unintentional, Pig will fail later, possibly with a different error message.
Disadvantage of a) is it mandates user to escape $, where its possible not to have such requirement.
Advantage is a clear error message can be thrown if no substitution was unintentional.

What do you think which option shall we choose? 

> Parameter substitution ($PARAMETER) should not be performed in comments
> -----------------------------------------------------------------------
>                 Key: PIG-598
>                 URL: https://issues.apache.org/jira/browse/PIG-598
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.2.0
>            Reporter: David Ciemiewicz
>            Assignee: Thejas M Nair
>         Attachments: PIG-598.1.patch, PIG-598.patch
> Compiling the following code example will generate an error that $NOT_A_PARAMETER is
an Undefined Parameter.
> This is problematic as sometimes you want to comment out parts of your code, including
parameters so that you don't have to define them.
> This I think it would be really good if parameter substitution was not performed in comments.
> {code}
> {code}
> {code}
> -bash-3.00$ pig -exectype local -latest comment.pig
> USING: /grid/0/gs/pig/current
> java.lang.RuntimeException: Undefined parameter : NOT_A_PARAMETER
>         at org.apache.pig.tools.parameters.PreprocessorContext.substitute(PreprocessorContext.java:221)
>         at org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor.parsePigFile(ParameterSubstitutionPreprocessor.java:106)
>         at org.apache.pig.tools.parameters.ParameterSubstitutionPreprocessor.genSubstitutedFile(ParameterSubstitutionPreprocessor.java:86)
>         at org.apache.pig.Main.runParamPreprocessor(Main.java:394)
>         at org.apache.pig.Main.main(Main.java:296)
> {code}

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message