Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Pig Wiki" for change 
notification.

The following page has been changed by OlgaN:
http://wiki.apache.org/pig/ParameterSubstitution

------------------------------------------------------------------------------
  
  For this example, pig would execute `generate_date` command when it 
encounters the `declare` statement and assigns the result (stdout) to parameter 
`CMD`. The value of `CMD` is substituted prior to running the load statement.
  
- `declare` statement starts with `%` to indicate that it is part of the 
preprocessor that performs parameter substitution rather than Pig language 
itself. 
+ `declare` statement starts with `%` to indicate that it is part of the 
preprocessor that performs parameter substitution rather than Pig language 
itself. The declare statement runs till the end of the line unless the value is 
a literal in which case it can take multiple lines.
  
  `declare` can also be used to define one parameter in terms of others:
  
@@ -106, +106 @@

  
  Files and command line parameters can be combined, with command line 
parameters taking precedence over files in case of duplicate parameters.
  
- `declare` command takes the highest precedence. Having multiple `declare` 
commands defining the same parameter is an error that results in an error 
message and abort of the processing.
+ `declare` command takes the highest precedence. The scope of parameter value 
defined via `declare` is all the lines following `declare` command until the 
next `declare` command that defines this parameter is encountered.
  
- Default parameter values can be specified in a script using `%default <param> 
<value>` statement. This statement is identical to `declare` except that it has 
the lowest precedence meaning that its value is only used if it has not been 
defined before.
+ Default parameter values can be specified in a script using `%default <param> 
<value>` statement. This statement is identical to `declare` except that it has 
the lowest precedence meaning that its value is only used if it has not been 
defined before. Only first `default` statement for a particular parameter is 
meaningful. The rest are warned on and are ignored.
  
  {{{
  %default cmd=generate_name

Reply via email to