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

Alan Gates commented on PIG-58:
-------------------------------

The code as checked in included an import that was java 1.6 specific.  The 
import was spurious, so I've checked in a fix that resolved it (revision 
646546).  But if you see the following error:

  [javac] Compiling 229 source files to 
/home/gates/src/pig/PIG-111/trunk/build/classes
    [javac] 
/home/gates/src/pig/PIG-111/trunk/src/org/apache/pig/tools/parameters/ParameterSubstitutionPreprocessor.java:31:
 cannot find symbol
    [javac] symbol  : class Console
    [javac] location: package java.io
    [javac] import java.io.Console;
    [javac]                ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error

The solution is to either update to the listed revision or remove the import 
for java.io.Console from 
src/org/apache/pig/tools/parameters/ParameterSubstitutionPreprocessor.jav

> parameterized Pig scripts
> -------------------------
>
>                 Key: PIG-58
>                 URL: https://issues.apache.org/jira/browse/PIG-58
>             Project: Pig
>          Issue Type: New Feature
>            Reporter: Olga Natkovich
>         Attachments: PIG-58_v1.patch, PIG-58_v2, PIG-58_v3.patch
>
>
> This feature has been requested by several users and would be very useful in 
> conjunction with streaming. The feature would allow pig script to include 
> parameters that are replaced at run time. For instance, if your script needs 
> to run on a daily basis over the data of the previous day, you would be able 
> to use the script and providing a date as a run-time parameter to it.
> Example:
> =======
> Pig script myscript.pig:
> A = load '/data/mydata/%date%';
> B = filter A by $0>'5';
> .....
> Pig command line:
> pig -param date='20080110' myscript.pig
> Proposed interface and implementation:
> Interface:
> =======
> (0) Substitution will be only supported with pig script files.
> (1) Parameters are specified on the command line via -param <param>=<val> 
> construct. Multiple parameters can be specified. They are applied to the 
> script in the order they are specified on the command line
> (2) Default values for the parameters can be specified within the script via 
> decare statement:
> decare <param>=<value>
> (3) Withint the script the parameter will be enclosed in %%. \% can be used 
> te escape.
> Implementation:
> ============
> Use preprocessor to do the substitution. The preprocessor would be invoced by 
> Main before grunt is instanciated and do the following:
> - create a new file in temp location
> - build a hash of parameters from command line and declare statement
> - for each line in the original script
>   if this is a declare line, skip it
>   else for each unescaped pattern %<identifie>% look for a match in the hash. 
> Replace, if found.  Write the line to the temp file.
> - pass the temp file to grunt.

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

Reply via email to