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

------------------------------------------------------------------------------
  
  A -dryrun option will be added to pig in which case no execution is performed 
and substituted script is produced. We can also use the same option to produce 
just the execution plan.
  
+ === Logging === 
+ 
+ Pig uses apache commons(http://commons.apache.org/logging/) in conjunction 
with log4j(http://logging.apache.org/log4j/) and we should to the same in the 
parameter substitution code.
+ 
+ The following code can be used to instanciate a logger:
+ 
+ {{{
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ ....
+ 
+ class ParameterSubstitutionPreprocessor
+ {
+     private final Log log = LogFactory.getLog(getClass());
+     ....
+ }
+ }}}
+ 
+ Note that this code will work once we integrate this into Pig.
+ 
+ Pig uses INFO as the default log level. Any messages that you want users to 
see during normal operation should be logged at this level. Anything that is 
only useful for debugging, should be logged at DEBUG level. Warnings should be 
logged at WARN level.
+ 
+ === Error Handling ===
+ 
+ All the errors should be propagated via exceptions. (The code should not use 
exit calls to make sure that the caller can react to the error.)
+ 
+ The following exceptions should be used:
+ 
+  * ParseExceptions - for any errors due to parsing command line or config 
file parameters or pig script.
+  * If the underlying code throws an exception and the exception is derived 
from RuntimeException - just let it propagate
+  * If the underlying code throws an exception that is not derived from 
RuntimeException, catch it and throw a RuntimeException with the original 
exception as the cause. (We want to make sure that we don't have to declare 
additional exceptions in our APIs.)
+  * Any exception that the code originates should be either RuntimeException 
or its derivation if appropriate.
+ 
  == Design ==
  
  A C-style preprocessor will be written to perform parameter substitution. The 
preprocessor will do the following:

Reply via email to