Return-Path: Delivered-To: apmail-incubator-pig-dev-archive@locus.apache.org Received: (qmail 46522 invoked from network); 6 Apr 2008 22:09:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Apr 2008 22:09:03 -0000 Received: (qmail 57885 invoked by uid 500); 6 Apr 2008 22:09:04 -0000 Delivered-To: apmail-incubator-pig-dev-archive@incubator.apache.org Received: (qmail 57860 invoked by uid 500); 6 Apr 2008 22:09:04 -0000 Mailing-List: contact pig-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pig-dev@incubator.apache.org Delivered-To: mailing list pig-dev@incubator.apache.org Received: (qmail 57851 invoked by uid 99); 6 Apr 2008 22:09:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Apr 2008 15:09:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Apr 2008 22:08:30 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4382E234C0B5 for ; Sun, 6 Apr 2008 15:06:24 -0700 (PDT) Message-ID: <335415401.1207519584262.JavaMail.jira@brutus> Date: Sun, 6 Apr 2008 15:06:24 -0700 (PDT) From: "Olga Natkovich (JIRA)" To: pig-dev@incubator.apache.org Subject: [jira] Updated: (PIG-58) parameterized Pig scripts In-Reply-To: <13321520.1200004113974.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PIG-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Olga Natkovich updated PIG-58: ------------------------------ Attachment: PIG-58_v1.patch The patch contains the initial implementation provided by a tean at Yahoo. I have made some modification and also integrated it into pig. The code includes an extenssive set of unit tests which all pass. Also, all existing unit and end-to-end tests are passing. I ran several end-to-end tests and they also pass. More end-to-end testing is on the way. Also, update the specification: http://wiki.apache.org/pig/ParameterSubstitution > 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 > > > 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 = 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 = > (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 %% 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.