You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by Apache Wiki <wi...@apache.org> on 2008/10/20 23:37:59 UTC

[Pig Wiki] Update of "PigErrorHandling" by SanthoshSrinivasan

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 SanthoshSrinivasan:
http://wiki.apache.org/pig/PigErrorHandling

New page:
= Error Handling =

This document captures the requirements for the Error Handling feature in Pig.

== Introduction ==

Robustness of software is an implicit requirement. Users expect and rightfully so, that software reports clearly and in an understandable fashion about the errors that occur when using the software. The errors encountered while using the software could be due to multiple sources. Some of the popular ones are:

 1. Environment issues: file not found, out of disk space, etc.
 2. Bugs in the software: null pointer exceptions, core dumps, out of bound access, etc.
 3. Programmer error: Syntax errors, divide by zero, incorrect use of casts, etc.

Users rely on the error messages to inform them about the source of the error along with a reasonable message that will influence the corrective course of action. While most errors cannot be handled in the system, at the least they should be reported in a reliable and readable manner.

== Background ==

Using the approach mentioned in ref1, Pig can be divided into three components for the purpose of error handling. A schematic view of the system is illustrated via the diagram.

 1. The user interface. This could be the grunt shell or the command line execution of a script or using Pig via the Java APIs
 2. Pig
 3. The backend execution framework, i.e., Hadoop

Grunt is an interactive shell that allows users to submit Pig commands. The command line offers a mechanism for batch mode execution via scripts. The Java APIs provide a programmatic mechanism of accessing Pig. Irrespective of the mechanism, the control and data flow through Pig which in turn uses Hadoop as the execution framework. Errors could occur within each system and across systems.


== Requirements ==

=== Early error detection ===

Errors that occur in each system should be caught as early as possible. A few examples that demonstrate this behavior are: 

 1. Syntax errors. E.g.: Missing ';'
 2. Semantic errors. E.g: Mismatch in cogroup arity
 3. Validation errors. E.g: Type mismatch when trying to add a string to an integer

Pig relies on Hadoop for run time execution. Detection and reporting errors early will improve turnaround time.

=== Error reporting ===

Provide users with readable error messages. Stack traces provide a good mechanism to help debugging but do not mean much to the user. Readable and simple error messages will be presented on STDERR. Error codes will be devised for common error messages. Detailed information like stack trace will be logged into client side logs. Users can send logs that contain the details of the error like stack trace to assist developers in resolving issues.

'''Note:''' 

 1. Users are responsible for purging error logs
 2. Users will be able switch on/off the detailed error messages on STDERR.
 3. Since Pig depends on Hadoop for execution, Hadoop error messages will be reported by Pig


=== Warning message aggregation ===

With the introduction of types and NULLs into Pig, there are several scenarios where Pig warns the user about introduction of casts, divide by zero uses, etc. The warning messages are issued on each occurrence of the warning. While this message is useful, the increased frequency of the messages is annoying and distracts the user from possible error messages. In order to alleviate this problem, warning message aggregation will be supported to report the warning message and the number of occurrences of the warning message.

'''Note:'''

 1. Users will be able switch to turn on/off warning message aggregation


== References: ==

 1. Mika Raento, "What should Exceptions look like?" July 30, 2006, http://www.errorhandling.org/wordpress/
 2. Bruce Eckel, "Thinking in Java", 3rd Edition Revision 4.0, November 20, 2002, http://www.faqs.org/docs/think_java/TIJ3_c.htm