You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by xu...@apache.org on 2011/04/04 20:31:29 UTC

svn commit: r1088700 [1/2] - in /pig/trunk: ./ src/org/apache/pig/ src/org/apache/pig/impl/logicalLayer/validators/ src/org/apache/pig/impl/plan/ src/org/apache/pig/newplan/ src/org/apache/pig/newplan/logical/expression/ src/org/apache/pig/newplan/logi...

Author: xuefu
Date: Mon Apr  4 18:31:28 2011
New Revision: 1088700

URL: http://svn.apache.org/viewvc?rev=1088700&view=rev
Log:
PIG-1918: Line number should be give for logical plan failures (xuefu)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/PigServer.java
    pig/trunk/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckerException.java
    pig/trunk/src/org/apache/pig/impl/plan/PlanValidationException.java
    pig/trunk/src/org/apache/pig/impl/plan/VisitorException.java
    pig/trunk/src/org/apache/pig/newplan/Operator.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanEqualExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/IsNullExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanEqualExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/MapLookupExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/ModExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/MultiplyExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/NegativeExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/NotEqualExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/NotExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/OrExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/ProjectExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/RegexExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/ScalarExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/SubtractExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/UnaryExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/expression/UserFuncExpression.java
    pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java
    pig/trunk/src/org/apache/pig/newplan/logical/rules/InputOutputFileValidator.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/ColumnAliasConversionVisitor.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/LineageFindRelVisitor.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/ScalarVisitor.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/SchemaAliasVisitor.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/SortInfoSetter.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/TypeCheckingExpVisitor.java
    pig/trunk/src/org/apache/pig/newplan/logical/visitor/TypeCheckingRelVisitor.java
    pig/trunk/src/org/apache/pig/parser/AstValidator.g
    pig/trunk/src/org/apache/pig/parser/DuplicatedSchemaAliasException.java
    pig/trunk/src/org/apache/pig/parser/LogicalPlanBuilder.java
    pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
    pig/trunk/src/org/apache/pig/parser/PigRecognitionException.java
    pig/trunk/src/org/apache/pig/parser/SourceLocation.java
    pig/trunk/src/org/apache/pig/parser/UndefinedAliasException.java
    pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Mon Apr  4 18:31:28 2011
@@ -26,6 +26,8 @@ PIG-1680: HBaseStorage should work with 
 
 IMPROVEMENTS
 
+PIG-1918: Line number should be give for logical plan failures (xuefu)
+
 PIG-1899: Add end to end test harness for Pig (gates)
 
 PIG-1932: GFCross should allow the user to set the DEFAULT_PARALLELISM value (gates)

Modified: pig/trunk/src/org/apache/pig/PigServer.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/PigServer.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/PigServer.java (original)
+++ pig/trunk/src/org/apache/pig/PigServer.java Mon Apr  4 18:31:28 2011
@@ -89,7 +89,6 @@ import org.apache.pig.newplan.logical.re
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 import org.apache.pig.newplan.logical.visitor.CastLineageSetter;
 import org.apache.pig.newplan.logical.visitor.ColumnAliasConversionVisitor;
-import org.apache.pig.newplan.logical.visitor.ProjectStarExpander;
 import org.apache.pig.newplan.logical.visitor.ScalarVisitor;
 import org.apache.pig.newplan.logical.visitor.SchemaAliasVisitor;
 import org.apache.pig.newplan.logical.visitor.TypeCheckingRelVisitor;

Modified: pig/trunk/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckerException.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckerException.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckerException.java (original)
+++ pig/trunk/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckerException.java Mon Apr  4 18:31:28 2011
@@ -93,6 +93,18 @@ public class TypeCheckerException extend
     /**
      * Create a new TypeCheckerException with the specified message and cause.
      *
+     * @param op - The logical operator where the error occurred
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
+     * @param errSrc - The error source 
+     */
+    public TypeCheckerException(org.apache.pig.newplan.Operator op, String message, int errCode, byte errSrc) {
+        super(op, message, errCode, errSrc);
+    }
+
+    /**
+     * Create a new TypeCheckerException with the specified message and cause.
+     *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
      * @param errSrc - The error source
@@ -106,6 +118,20 @@ public class TypeCheckerException extend
     /**
      * Create a new TypeCheckerException with the specified message and cause.
      *
+     * @param op - The logical operator where the error occurred
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
+     * @param errSrc - The error source
+     * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown. 
+     */
+    public TypeCheckerException(org.apache.pig.newplan.Operator op, String message, int errCode, byte errSrc,
+            Throwable cause) {
+        super(op, message, errCode, errSrc, cause);
+    }
+
+    /**
+     * Create a new TypeCheckerException with the specified message and cause.
+     *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
      * @param retry - If the exception is retriable or not

Modified: pig/trunk/src/org/apache/pig/impl/plan/PlanValidationException.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/impl/plan/PlanValidationException.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/impl/plan/PlanValidationException.java (original)
+++ pig/trunk/src/org/apache/pig/impl/plan/PlanValidationException.java Mon Apr  4 18:31:28 2011
@@ -38,6 +38,16 @@ public class PlanValidationException ext
     }
     
     /**
+     * Create a new PlanValidationException with the specified message and cause.
+     *
+     * @param op - logical operator where the exception occurs
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     */
+    public PlanValidationException(org.apache.pig.newplan.Operator op, String message) {
+        super(op, message);
+    }
+
+    /**
      * Create a new PlanValidationException with the specified cause.
      *
      * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.
@@ -71,6 +81,16 @@ public class PlanValidationException ext
      *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
+     */
+    public PlanValidationException(org.apache.pig.newplan.Operator op, String message, int errCode) {
+        super(op, message, errCode);
+    }
+
+    /**
+     * Create a new PlanValidationException with the specified message and cause.
+     *
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
      * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown. 
      */
     public PlanValidationException(String message, int errCode, Throwable cause) {
@@ -93,6 +113,17 @@ public class PlanValidationException ext
      *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
+     * @param errSrc - The error source 
+     */
+    public PlanValidationException(org.apache.pig.newplan.Operator op, String message, int errCode, byte errSrc) {
+        super(op, message, errCode, errSrc);
+    }   
+
+    /**
+     * Create a new PlanValidationException with the specified message and cause.
+     *
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
      * @param errSrc - The error source
      * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown. 
      */

Modified: pig/trunk/src/org/apache/pig/impl/plan/VisitorException.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/impl/plan/VisitorException.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/impl/plan/VisitorException.java (original)
+++ pig/trunk/src/org/apache/pig/impl/plan/VisitorException.java Mon Apr  4 18:31:28 2011
@@ -40,6 +40,16 @@ public class VisitorException extends Fr
     }
 
     /**
+     * Create a new VisitorException with the specified message and cause.
+     *
+     * @param op - logical operator where the exception occurs
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     */
+    public VisitorException(org.apache.pig.newplan.Operator op, String message) {
+        super(op.getLocation() + message);
+    }
+
+    /**
      * Create a new VisitorException with the specified cause.
      *
      * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.
@@ -71,6 +81,17 @@ public class VisitorException extends Fr
     /**
      * Create a new VisitorException with the specified message and cause.
      *
+     * @param op - logical operator where the exception occurs
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
+     */
+    public VisitorException(org.apache.pig.newplan.Operator op, String message, int errCode) {
+        super(op.getLocation() + message, errCode);
+    }
+
+    /**
+     * Create a new VisitorException with the specified message and cause.
+     *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
      * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown. 
@@ -93,6 +114,18 @@ public class VisitorException extends Fr
     /**
      * Create a new VisitorException with the specified message and cause.
      *
+     * @param op - logical operator where the exception occurs
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
+     * @param errSrc - The error source 
+     */
+    public VisitorException(org.apache.pig.newplan.Operator op, String message, int errCode, byte errSrc) {
+        super(op.getLocation() + message, errCode, errSrc);
+    }
+
+    /**
+     * Create a new VisitorException with the specified message and cause.
+     *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
      * @param errSrc - The error source
@@ -106,6 +139,20 @@ public class VisitorException extends Fr
     /**
      * Create a new VisitorException with the specified message and cause.
      *
+     * @param op - logical operator where the exception occurs
+     * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
+     * @param errCode - The error code shown to the user 
+     * @param errSrc - The error source
+     * @param cause - The cause (which is saved for later retrieval by the <link>Throwable.getCause()</link> method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown. 
+     */
+    public VisitorException(org.apache.pig.newplan.Operator op, String message, int errCode, byte errSrc,
+            Throwable cause) {
+        super(op.getLocation() + message, errCode, errSrc, cause);
+    }
+
+    /**
+     * Create a new VisitorException with the specified message and cause.
+     *
      * @param message - The error message (which is saved for later retrieval by the <link>Throwable.getMessage()</link> method) shown to the user 
      * @param errCode - The error code shown to the user 
      * @param retry - If the exception is retriable or not

Modified: pig/trunk/src/org/apache/pig/newplan/Operator.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/Operator.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/Operator.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/Operator.java Mon Apr  4 18:31:28 2011
@@ -22,8 +22,10 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.parser.SourceLocation;
 
 public abstract class Operator {
+    protected SourceLocation location; // The location of the operator in the original pig script.
     
     protected String name;
     protected OperatorPlan plan; // plan that contains this operator
@@ -34,6 +36,7 @@ public abstract class Operator {
         name = n;
         plan = p;
         annotations = new HashMap<String, Object>();
+        location = new SourceLocation();
     }
 
     /**
@@ -47,6 +50,14 @@ public abstract class Operator {
         return name;
     }
     
+    public SourceLocation getLocation() {
+        return location;
+    }
+    
+    public void setLocation(SourceLocation loc) {
+        location = loc;
+    }
+    
     /**
      * Get the plan associated with this operator.
      * @return plan

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Add Operator
@@ -78,6 +79,7 @@ public class AddExpression extends Binar
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Boolean and expression.
@@ -79,6 +80,7 @@ public class AndExpression extends Binar
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.OperatorPl
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class BinCondExpression extends LogicalExpression {
 
@@ -114,6 +115,7 @@ public class BinCondExpression extends L
                 this.getCondition().deepCopy(lgExpPlan),
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class CastExpression extends UnaryExpression {
     private FuncSpec castFunc;
@@ -97,6 +98,7 @@ public class CastExpression extends Unar
         } catch(CloneNotSupportedException e) {
             e.printStackTrace(); 
         }
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java Mon Apr  4 18:31:28 2011
@@ -28,6 +28,7 @@ import org.apache.pig.newplan.OperatorPl
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.Util;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * A constant
@@ -105,7 +106,9 @@ public class ConstantExpression extends 
  
     @Override
     public LogicalExpression deepCopy(LogicalExpressionPlan lgExpPlan) throws FrontendException{
-        return new ConstantExpression(lgExpPlan, this.getValue());
+        LogicalExpression copy = new ConstantExpression(lgExpPlan, this.getValue());
+        copy.setLocation( new SourceLocation( location ) );
+        return copy;
     }
  
 }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java Mon Apr  4 18:31:28 2011
@@ -28,6 +28,7 @@ import org.apache.pig.newplan.OperatorPl
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * 
@@ -208,6 +209,7 @@ public class DereferenceExpression exten
         lgExpPlan.add( inputCopy );
         lgExpPlan.connect( copy, inputCopy );
         
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Divide Operator
@@ -78,6 +79,7 @@ public class DivideExpression extends Bi
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Equality test expression.
@@ -81,6 +82,7 @@ public class EqualExpression extends Bin
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanEqualExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanEqualExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanEqualExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanEqualExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class GreaterThanEqualExpression extends BinaryExpression {
 
@@ -75,6 +76,7 @@ public class GreaterThanEqualExpression 
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class GreaterThanExpression extends BinaryExpression {
 
@@ -75,6 +76,7 @@ public class GreaterThanExpression exten
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/IsNullExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/IsNullExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/IsNullExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/IsNullExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class IsNullExpression extends UnaryExpression {
 
@@ -63,6 +64,7 @@ public class IsNullExpression extends Un
         LogicalExpression copy = new IsNullExpression ( 
                 lgExpPlan,
                 this.getExpression().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanEqualExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanEqualExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanEqualExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanEqualExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class LessThanEqualExpression extends BinaryExpression {
 
@@ -75,6 +76,7 @@ public class LessThanEqualExpression ext
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class LessThanExpression extends BinaryExpression {
 
@@ -75,6 +76,7 @@ public class LessThanExpression extends 
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/MapLookupExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/MapLookupExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/MapLookupExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/MapLookupExpression.java Mon Apr  4 18:31:28 2011
@@ -26,6 +26,7 @@ import org.apache.pig.newplan.OperatorPl
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class MapLookupExpression extends ColumnExpression {
 
@@ -135,6 +136,7 @@ public class MapLookupExpression extends
         LogicalExpression inputCopy = input.deepCopy( lgExpPlan );
         lgExpPlan.add( inputCopy );
         lgExpPlan.connect( copy, inputCopy );
+        copy.setLocation( new SourceLocation( location ) );
         
         return copy;
     }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/ModExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/ModExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/ModExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/ModExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Mod Operator
@@ -78,6 +79,7 @@ public class ModExpression extends Binar
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan));
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/MultiplyExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/MultiplyExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/MultiplyExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/MultiplyExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Multiply Operator
@@ -78,6 +79,7 @@ public class MultiplyExpression extends 
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/NegativeExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/NegativeExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/NegativeExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/NegativeExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class NegativeExpression extends UnaryExpression {
 
@@ -63,6 +64,7 @@ public class NegativeExpression extends 
         LogicalExpression copy = new NegativeExpression(
                 lgExpPlan,
                 this.getExpression().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/NotEqualExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/NotEqualExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/NotEqualExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/NotEqualExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * NotEquality test expression.
@@ -79,6 +80,7 @@ public class NotEqualExpression extends 
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/NotExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/NotExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/NotExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/NotExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class NotExpression extends UnaryExpression {
 
@@ -63,6 +64,7 @@ public class NotExpression extends Unary
         LogicalExpression copy = new NotExpression(
                 lgExpPlan,
                 this.getExpression().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/OrExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/OrExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/OrExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/OrExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Boolean OR Expression
@@ -79,6 +80,7 @@ public class OrExpression extends Binary
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/ProjectExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/ProjectExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/ProjectExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/ProjectExpression.java Mon Apr  4 18:31:28 2011
@@ -34,6 +34,7 @@ import org.apache.pig.newplan.logical.re
 import org.apache.pig.newplan.logical.relational.LogicalRelationalOperator;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Projection of columns in an expression.
@@ -90,7 +91,7 @@ public class ProjectExpression extends C
      * @throws FrontendException 
      */
     public ProjectExpression(OperatorPlan plan, int inputNum, String alias,
-            LogicalRelationalOperator attachedRelationalOp) throws FrontendException {
+            LogicalRelationalOperator attachedRelationalOp) {
         super("Project", plan);
         this.input = inputNum;
         this.alias = alias;
@@ -151,14 +152,14 @@ public class ProjectExpression extends C
             if(startCol < 0){
                 String msg = "Invalid start column position in " +
                 "range projection (..) " + startCol;
-                throw new FrontendException(msg, 2270, PigException.BUG);
+                throw new PlanValidationException(this, msg, 2270, PigException.BUG);
             }
             
             if(endCol > 0 && startCol > endCol){
                 String msg = "start column appears after end column in " +
                 "range projection (..) . Start column position " + startCol +
                 " End column position " + endCol;
-                throw new FrontendException(msg, 1127, PigException.INPUT);
+                throw new PlanValidationException(this, msg, 1127, PigException.INPUT);
             }
         }else{
             setColNum(findColNum(alias));
@@ -174,7 +175,7 @@ public class ProjectExpression extends C
         if( alias != null ) {
             int colNum = inputSchema == null ? -1 : inputSchema.getFieldPosition( alias );
             if( colNum == -1 ) {
-                throw new PlanValidationException(
+                throw new PlanValidationException( this,
                         "Invalid field projection. Projected field [" + 
                         alias + "] does not exist in schema: " +
                         (inputSchema!=null?inputSchema.toString(false):"") + ".", 1025 );
@@ -183,7 +184,7 @@ public class ProjectExpression extends C
         } else {
             int col = getColNum();
             if( inputSchema != null && col >= inputSchema.size() ) {
-                throw new PlanValidationException( 
+                throw new PlanValidationException( this,
                         "Out of bound access. Trying to access non-existent column: " + 
                         col + ". Schema " +  inputSchema.toString(false) + 
                         " has " + inputSchema.size() + " column(s)." , 1000);
@@ -501,7 +502,8 @@ public class ProjectExpression extends C
                 this.getInputNum(),
                 this.getColNum(),
                 this.getAttachedRelationalOp());
-        copy.alias = this.alias; 
+        copy.setLocation( new SourceLocation( location ) );
+        copy.alias = alias; 
         copy.isRangeProject = this.isRangeProject;
         copy.startCol = this.startCol;
         copy.endCol = this.endCol;

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/RegexExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/RegexExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/RegexExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/RegexExpression.java Mon Apr  4 18:31:28 2011
@@ -24,6 +24,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Regex Operator
@@ -79,6 +80,7 @@ public class RegexExpression extends Bin
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/ScalarExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/ScalarExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/ScalarExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/ScalarExpression.java Mon Apr  4 18:31:28 2011
@@ -30,6 +30,7 @@ import org.apache.pig.newplan.PlanVisito
 import org.apache.pig.newplan.logical.relational.LogicalRelationalOperator;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class ScalarExpression extends UserFuncExpression {
     private Operator implicitReferencedOperator = null;
@@ -96,6 +97,7 @@ public class ScalarExpression extends Us
             }
         }
         
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
 

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/SubtractExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/SubtractExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/SubtractExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/SubtractExpression.java Mon Apr  4 18:31:28 2011
@@ -23,6 +23,7 @@ import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Subtract Operator
@@ -78,6 +79,7 @@ public class SubtractExpression extends 
                 lgExpPlan,
                 this.getLhs().deepCopy(lgExpPlan),
                 this.getRhs().deepCopy(lgExpPlan) );
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
  

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/UnaryExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/UnaryExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/UnaryExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/UnaryExpression.java Mon Apr  4 18:31:28 2011
@@ -19,7 +19,6 @@
 package org.apache.pig.newplan.logical.expression;
 
 import java.util.List;
-import java.io.IOException;
 
 import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;

Modified: pig/trunk/src/org/apache/pig/newplan/logical/expression/UserFuncExpression.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/expression/UserFuncExpression.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/expression/UserFuncExpression.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/expression/UserFuncExpression.java Mon Apr  4 18:31:28 2011
@@ -31,6 +31,7 @@ import org.apache.pig.newplan.OperatorPl
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.Util;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
+import org.apache.pig.parser.SourceLocation;
 
 public class UserFuncExpression extends LogicalExpression {
 
@@ -164,6 +165,7 @@ public class UserFuncExpression extends 
         } catch(CloneNotSupportedException e) {
              e.printStackTrace();
         }
+        copy.setLocation( new SourceLocation( location ) );
         return copy;
     }
     

Modified: pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java Mon Apr  4 18:31:28 2011
@@ -27,6 +27,7 @@ import org.apache.pig.newplan.PlanVisito
 import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
 import org.apache.pig.newplan.logical.expression.ProjectExpression;
 import org.apache.pig.newplan.logical.relational.LogicalSchema.LogicalFieldSchema;
+import org.apache.pig.parser.SourceLocation;
 
 /**
  * Operator to map the data into the inner plan of LOForEach
@@ -175,4 +176,10 @@ public class LOInnerLoad extends Logical
         }
         return msg.toString();
     }
+    
+    @Override
+    public void setLocation(SourceLocation loc) {
+    	super.setLocation( loc );
+    	prj.setLocation( loc );
+    }
 }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/rules/InputOutputFileValidator.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/rules/InputOutputFileValidator.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/rules/InputOutputFileValidator.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/rules/InputOutputFileValidator.java Mon Apr  4 18:31:28 2011
@@ -26,18 +26,11 @@ import org.apache.pig.StoreFuncInterface
 import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.plan.VisitorException;
 import org.apache.pig.newplan.DepthFirstWalker;
 import org.apache.pig.newplan.OperatorPlan;
-import org.apache.pig.newplan.PlanWalker;
-import org.apache.pig.newplan.logical.Util;
-import org.apache.pig.newplan.logical.relational.LOCogroup;
 import org.apache.pig.newplan.logical.relational.LOStore;
-import org.apache.pig.newplan.logical.relational.LogicalPlan;
 import org.apache.pig.newplan.logical.relational.LogicalRelationalNodesVisitor;
-import org.apache.pig.newplan.logical.relational.LogicalRelationalOperator;
-import org.apache.pig.newplan.logical.rules.GroupByConstParallelSetter.GroupAllParallelSetterTransformer;
-import org.apache.pig.newplan.optimizer.Rule;
-import org.apache.pig.newplan.optimizer.Transformer;
 
 public class InputOutputFileValidator {
     private PigContext pigCtx;
@@ -79,7 +72,7 @@ public class InputOutputFileValidator {
                 } 
                 String exceptionMsg = ioe.getMessage();
                 validationErrStr += (exceptionMsg == null) ? "" : " More info to follow:\n" +exceptionMsg;
-                throw new FrontendException(validationErrStr, errCode, pigCtx.getErrorSource(), ioe);
+                throw new VisitorException(store, validationErrStr, errCode, pigCtx.getErrorSource(), ioe);
             }
             
             validationErrStr += " More info to follow:\n";
@@ -99,10 +92,10 @@ public class InputOutputFileValidator {
                     break;
                 }
                 validationErrStr  += ioe.getMessage();
-                throw new FrontendException(validationErrStr, errCode, errSrc, ioe);
+                throw new VisitorException(store, validationErrStr, errCode, errSrc, ioe);
             } catch (InterruptedException ie) {
                 validationErrStr += ie.getMessage();
-                throw new FrontendException(validationErrStr, errCode, pigCtx.getErrorSource(), ie);
+                throw new VisitorException(store, validationErrStr, errCode, pigCtx.getErrorSource(), ie);
             }
         }
     }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/ColumnAliasConversionVisitor.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/ColumnAliasConversionVisitor.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/ColumnAliasConversionVisitor.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/ColumnAliasConversionVisitor.java Mon Apr  4 18:31:28 2011
@@ -25,7 +25,6 @@ import org.apache.pig.data.DataType;
 import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.plan.PlanValidationException;
 import org.apache.pig.newplan.DependencyOrderWalker;
-import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.logical.expression.DereferenceExpression;
 import org.apache.pig.newplan.logical.expression.LogicalExpression;
@@ -33,8 +32,6 @@ import org.apache.pig.newplan.logical.ex
 import org.apache.pig.newplan.logical.expression.LogicalExpressionVisitor;
 import org.apache.pig.newplan.logical.expression.ProjectExpression;
 import org.apache.pig.newplan.logical.optimizer.AllExpressionVisitor;
-import org.apache.pig.newplan.logical.relational.LogicalPlan;
-import org.apache.pig.newplan.logical.relational.LogicalRelationalOperator;
 import org.apache.pig.newplan.logical.relational.LogicalSchema;
 
 /**
@@ -84,14 +81,14 @@ public class ColumnAliasConversionVisito
                     if( rc instanceof Integer ) {
                     	col = (Integer)rc;
                     	if( schema != null && col >= schema.size() ) {
-                            throw new PlanValidationException( "Out of bound access. Trying to access non-existent column: " + 
+                            throw new PlanValidationException( expr, "Out of bound access. Trying to access non-existent column: " + 
                                     col + ". Schema " + schema.toString(false) + " has " + schema.size() + " column(s).", 1000 );
                     	}
                         cols.add( (Integer)rc );
                     } else {
                         col = schema == null ? -1 : schema.getFieldPosition( (String)rc );
                         if( col == -1 ) {
-                            throw new PlanValidationException( "Invalid field reference. Referenced field [" + 
+                            throw new PlanValidationException( expr, "Invalid field reference. Referenced field [" + 
                             		rc + "] does not exist in schema: " + (schema!=null?schema.toString(false):"") + "." , 1000);
                         }
                         cols.add( col );

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/LineageFindRelVisitor.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/LineageFindRelVisitor.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/LineageFindRelVisitor.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/LineageFindRelVisitor.java Mon Apr  4 18:31:28 2011
@@ -26,7 +26,6 @@ import org.apache.pig.FuncSpec;
 import org.apache.pig.PigException;
 import org.apache.pig.data.DataType;
 import org.apache.pig.impl.logicalLayer.FrontendException;
-import org.apache.pig.impl.logicalLayer.schema.Schema.FieldSchema;
 import org.apache.pig.impl.plan.VisitorException;
 import org.apache.pig.impl.streaming.StreamingCommand;
 import org.apache.pig.impl.streaming.StreamingCommand.HandleSpec;
@@ -409,13 +408,13 @@ public class LineageFindRelVisitor exten
         if(inputSch == null || outSchema == null){
             String msg = "Bug: in split only one of input/output schema is null "
                 + split;
-            throw new VisitorException(msg,2260, PigException.BUG) ; 
+            throw new VisitorException(split, msg,2260, PigException.BUG) ; 
         }
         
         if(inputSch.size() != outSchema.size()){
             String msg = "Bug: input and output schema size of split differ "
                 + split;
-            throw new VisitorException(msg,2261, PigException.BUG) ; 
+            throw new VisitorException(split, msg,2261, PigException.BUG) ; 
         }
 
         for(int i=0; i<inputSch.size(); i++){

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/ProjectStarExpander.java Mon Apr  4 18:31:28 2011
@@ -25,6 +25,7 @@ import java.util.Map.Entry;
 
 import org.apache.pig.PigException;
 import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.plan.VisitorException;
 import org.apache.pig.impl.util.MultiMap;
 import org.apache.pig.newplan.DependencyOrderWalker;
 import org.apache.pig.newplan.DepthFirstWalker;
@@ -164,7 +165,7 @@ public class ProjectStarExpander extends
                         String msg = "Cogroup/Group by '*' or 'x..' " +
                         "(range of columns to the end) " +
                         "is only allowed if the input has a schema";
-                        throw new FrontendException(
+                        throw new VisitorException( cg,
                                 msg,
                                 1123,
                                 PigException.INPUT
@@ -178,7 +179,7 @@ public class ProjectStarExpander extends
             if(arity != inpExprPlans.get(i).size()) {
                 String msg = "The arity of cogroup/group by columns " +
                 "do not match";
-                throw new FrontendException(
+                throw new VisitorException(cg,
                         msg,
                         1122,
                         PigException.INPUT
@@ -215,11 +216,11 @@ public class ProjectStarExpander extends
             if(op instanceof LOGenerate){
                 if(gen != null){
                     String msg = "Expected single LOGenerate output in innerplan of foreach";
-                    throw new FrontendException(
+                    throw new VisitorException(foreach,
                             msg,
                             2266,
                             PigException.BUG
-                    );                    
+                    );
                 }
                 gen = (LOGenerate) op;
             }
@@ -573,7 +574,7 @@ public class ProjectStarExpander extends
                     if(outputs.size() > 1){
                         String msg = "More than one operator in an expression plan" +
                         " containing project star(*)/project-range (..)";
-                        throw new FrontendException(
+                        throw new VisitorException(proj,
                                 msg,
                                 2264,
                                 PigException.BUG

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/ScalarVisitor.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/ScalarVisitor.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/ScalarVisitor.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/ScalarVisitor.java Mon Apr  4 18:31:28 2011
@@ -82,7 +82,7 @@ public class ScalarVisitor extends AllEx
                     try {
                         fileSpec = new FileSpec( FileLocalizer.getTemporaryPath( pigContext ).toString(), funcSpec );                    // TODO: need to hookup the pigcontext.
                     } catch (IOException e) {
-                        throw new PlanValidationException( "Failed to process scalar: " + e);
+                        throw new PlanValidationException( expr, "Failed to process scalar" + e);
                     }
                     store = new LOStore( lp, fileSpec );
                     store.setTmpStore(true);

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/SchemaAliasVisitor.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/SchemaAliasVisitor.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/SchemaAliasVisitor.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/SchemaAliasVisitor.java Mon Apr  4 18:31:28 2011
@@ -71,7 +71,7 @@ public class SchemaAliasVisitor extends 
                         String msg = "Duplicate schema alias: " + schema.getField( i ).alias;
                         if( op.getAlias() != null )
                             msg = msg + " in \"" + op.getAlias() + "\"";
-                        throw new PlanValidationException( msg, errCode, PigException.INPUT );
+                        throw new PlanValidationException( op, msg, errCode, PigException.INPUT );
                     }
                     seenAliases.add(alias);
                 }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/SortInfoSetter.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/SortInfoSetter.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/SortInfoSetter.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/SortInfoSetter.java Mon Apr  4 18:31:28 2011
@@ -21,6 +21,7 @@ package org.apache.pig.newplan.logical.v
 import org.apache.pig.PigException;
 import org.apache.pig.SortInfo;
 import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.impl.plan.VisitorException;
 import org.apache.pig.newplan.DependencyOrderWalker;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
@@ -46,7 +47,7 @@ public class SortInfoSetter extends Logi
         if(storePred == null){
             int errCode = 2051;
             String msg = "Did not find a predecessor for Store." ;
-            throw new FrontendException(msg, errCode, PigException.BUG);    
+            throw new VisitorException(store, msg, errCode, PigException.BUG);    
         }
         
         SortInfo sortInfo = null;
@@ -72,12 +73,8 @@ public class SortInfoSetter extends Logi
         }
         // if this predecessor is a sort, get
         // the sort info.
-        if(storePred instanceof LOSort) {
-            try {
-                sortInfo = ((LOSort)storePred).getSortInfo();
-            } catch (FrontendException e) {
-                throw new FrontendException(e);
-            }
+        if( storePred instanceof LOSort ) {
+            sortInfo = ((LOSort)storePred).getSortInfo();
         }
         store.setSortInfo(sortInfo);
     }

Modified: pig/trunk/src/org/apache/pig/newplan/logical/visitor/TypeCheckingExpVisitor.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/newplan/logical/visitor/TypeCheckingExpVisitor.java?rev=1088700&r1=1088699&r2=1088700&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/newplan/logical/visitor/TypeCheckingExpVisitor.java (original)
+++ pig/trunk/src/org/apache/pig/newplan/logical/visitor/TypeCheckingExpVisitor.java Mon Apr  4 18:31:28 2011
@@ -168,7 +168,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1039;
             String msg = generateIncompatibleTypesMessage(binOp);
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(binOp, msg, errCode, PigException.INPUT) ;
         }
 
         binOp.resetFieldSchema();
@@ -211,14 +211,14 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1039;
             String msg = generateIncompatibleTypesMessage(binOp);
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(binOp, msg, errCode, PigException.INPUT) ;
         }
         binOp.resetFieldSchema();
     }
 
     private String generateIncompatibleTypesMessage(BinaryExpression binOp)
     throws FrontendException {
-        String msg = ""; 
+        String msg = binOp.toString(); 
         if (currentRelOp.getAlias()!=null){
             msg = "In alias " + currentRelOp.getAlias() + ", ";
         }
@@ -247,7 +247,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1041;
             String msg = "NEG can be used with numbers or Bytearray only" ;
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(negExp, msg, errCode, PigException.INPUT) ;
         }
 
         negExp.resetFieldSchema();
@@ -257,7 +257,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1040;
             String msg = "Could not set Negative field schema";
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT, fe) ;
+            throw new TypeCheckerException(negExp, msg, errCode, PigException.INPUT, fe) ;
         }
     }
     
@@ -272,7 +272,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1042;
             String msg = "NOT can be used with boolean only" ;
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException( notExp, msg, errCode, PigException.INPUT) ;
         }
 
     }
@@ -302,7 +302,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1038;
             String msg = "Operands of AND/OR can be boolean only" ;
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(boolExp, msg, errCode, PigException.INPUT) ;
         }
     }
 
@@ -403,7 +403,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1039;
             String msg = generateIncompatibleTypesMessage(binOp);
             msgCollector.collect(msg, MessageType.Error) ;
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(binOp, msg, errCode, PigException.INPUT) ;
         }
         //input types might have changed, regenerate field schema
         binOp.resetFieldSchema();
@@ -450,7 +450,7 @@ public class TypeCheckingExpVisitor exte
         catch (PlanException pe) {
             int errCode = 2059;
             String msg = "Problem with inserting cast operator for " + node + " in plan.";
-            throw new TypeCheckerException(msg, errCode, PigException.BUG, pe);
+            throw new TypeCheckerException(arg, msg, errCode, PigException.BUG, pe);
         }
         this.visit(cast);
     }
@@ -474,7 +474,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1051;
             String msg = "Cannot cast to bytearray";
             msgCollector.collect(msg, MessageType.Error) ;
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ; 
+            throw new TypeCheckerException(cast, msg, errCode, PigException.INPUT) ; 
         }
         
         LogicalFieldSchema inFs = cast.getExpression().getFieldSchema();
@@ -496,7 +496,7 @@ public class TypeCheckingExpVisitor exte
                            + DataType.findTypeName(outType)
                            + ((DataType.isSchemaType(outType))? " with schema " + outFs.toString(false) : "");
             msgCollector.collect(msg, MessageType.Error) ;
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ; 
+            throw new TypeCheckerException(cast, msg, errCode, PigException.INPUT) ; 
         }
        
     }
@@ -527,7 +527,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1037;
             String msg = "Operands of Regex can be CharArray only :" + rg;
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(rg, msg, errCode, PigException.INPUT) ;
         }
     }
     
@@ -538,7 +538,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1047;
             String msg = "Condition in BinCond must be boolean" ;
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(binCond, msg, errCode, PigException.INPUT) ;
         }       
         
         byte lhsType = binCond.getLhs().getType() ;
@@ -575,7 +575,7 @@ public class TypeCheckingExpVisitor exte
             } catch (FrontendException e) {
                 int errCode = 2216;
                 String msg = "Problem getting fieldSchema for " +binCond.getRhs();
-                throw new TypeCheckerException(msg, errCode, PigException.BUG, e);
+                throw new TypeCheckerException(binCond, msg, errCode, PigException.BUG, e);
             }
         } else if (binCond.getRhs() instanceof ConstantExpression
                 && ((ConstantExpression) binCond.getRhs()).getValue() == null) {
@@ -584,7 +584,7 @@ public class TypeCheckingExpVisitor exte
             } catch (FrontendException e) {
                 int errCode = 2216;
                 String msg = "Problem getting fieldSchema for " +binCond.getRhs();
-                throw new TypeCheckerException(msg, errCode, PigException.BUG, e);
+                throw new TypeCheckerException(binCond, msg, errCode, PigException.BUG, e);
             }
         } else if (lhsType == rhsType) {
             // Matching schemas if we're working with tuples/bags
@@ -596,7 +596,7 @@ public class TypeCheckingExpVisitor exte
                             + " left hand side: " + binCond.getLhs().getFieldSchema() 
                             + " right hand side: " + binCond.getRhs().getFieldSchema();
                         msgCollector.collect(msg, MessageType.Error) ;
-                        throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+                        throw new TypeCheckerException(binCond, msg, errCode, PigException.INPUT) ;
                     }
                     // TODO: We may have to merge the schema here
                     //       if the previous check is not exact match
@@ -605,7 +605,7 @@ public class TypeCheckingExpVisitor exte
                     int errCode = 1049;
                     String msg = "Problem during evaluaton of BinCond output type" ;
                     msgCollector.collect(msg, MessageType.Error) ;
-                    throw new TypeCheckerException(msg, errCode, PigException.INPUT, fe) ;
+                    throw new TypeCheckerException(binCond, msg, errCode, PigException.INPUT, fe) ;
                 }
             }
         }
@@ -616,7 +616,7 @@ public class TypeCheckingExpVisitor exte
                 + DataType.findTypeName(rhsType);
             
             msgCollector.collect(msg, MessageType.Error) ;
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+            throw new TypeCheckerException(binCond, msg, errCode, PigException.INPUT) ;
         }
         
 
@@ -645,14 +645,14 @@ public class TypeCheckingExpVisitor exte
                 int errCode = 1014;
                 String msg = "Problem with input " + op + " of User-defined function: " + func;
                 msgCollector.collect(msg, MessageType.Error);
-                throw new TypeCheckerException(msg, errCode, PigException.INPUT) ;
+                throw new TypeCheckerException(func, msg, errCode, PigException.INPUT) ;
             }
             try {
                 currentArgSchema.add(Util.translateFieldSchema(op.getFieldSchema()));    
             } catch (FrontendException e) {
                 int errCode = 1043;
                 String msg = "Unable to retrieve field schema.";
-                throw new TypeCheckerException(msg, errCode, PigException.INPUT, e);
+                throw new TypeCheckerException(func, msg, errCode, PigException.INPUT, e);
             }
             
         }
@@ -674,7 +674,7 @@ public class TypeCheckingExpVisitor exte
         } catch (Exception e) {
             int errCode = 1044;
             String msg = "Unable to get list of overloaded methods.";
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT, e);
+            throw new TypeCheckerException(func, msg, errCode, PigException.INPUT, e);
         }
         
         /**
@@ -722,7 +722,7 @@ public class TypeCheckingExpVisitor exte
                 //Oops, no exact match found. Trying to see if we
                 //have mappings that we can fit using casts.
                 notExactMatch = true;
-                if(byteArrayFound(currentArgSchema)){
+                if(byteArrayFound(func, currentArgSchema)){
                     // try "exact" matching all other fields except the byte array 
                     // fields and if they all exact match and we have only one candidate
                     // for the byte array cast then that's the matching one!
@@ -734,7 +734,7 @@ public class TypeCheckingExpVisitor exte
                                 + func.getFuncSpec()
                                 + " as multiple or none of them fit. Please use an explicit cast.";
                             msgCollector.collect(msg, MessageType.Error);
-                            throw new TypeCheckerException(msg, errCode, PigException.INPUT);
+                            throw new TypeCheckerException(func, msg, errCode, PigException.INPUT);
                         }
                     }
                 } else if ((matchingSpec = bestFitMatch(funcSpecs, currentArgSchema)) == null) {
@@ -748,7 +748,7 @@ public class TypeCheckingExpVisitor exte
                             + func.getFuncSpec()
                             + " as multiple or none of them fit. Please use an explicit cast.";
                     msgCollector.collect(msg, MessageType.Error);
-                    throw new TypeCheckerException(msg, errCode, PigException.INPUT);
+                    throw new TypeCheckerException(func, msg, errCode, PigException.INPUT);
                 }
             }
         }
@@ -778,7 +778,7 @@ public class TypeCheckingExpVisitor exte
             int errCode = 1040;
             String msg = "Could not set UserFunc field schema";
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT, fee) ;
+            throw new TypeCheckerException(func, msg, errCode, PigException.INPUT, fee) ;
         }
     }
     
@@ -826,11 +826,11 @@ public class TypeCheckingExpVisitor exte
                         + scoreFuncSpecList.get(0).second.getInputArgsSchema() + ", " 
                         + scoreFuncSpecList.get(1).second.getInputArgsSchema() + "). Please use an explicit cast.";
                 msgCollector.collect(msg, MessageType.Error);
-                throw new TypeCheckerException(msg, errCode, PigException.INPUT);
+                throw new TypeCheckerException(func, msg, errCode, PigException.INPUT);
             }
         
             // now consider the bytearray fields
-            List<Integer> byteArrayPositions = getByteArrayPositions(s);
+            List<Integer> byteArrayPositions = getByteArrayPositions(func, s);
             // make sure there is only one type to "cast to" for the byte array
             // positions among the candidate funcSpecs
             Map<Integer, Pair<FuncSpec, Byte>> castToMap = new HashMap<Integer, Pair<FuncSpec, Byte>>();
@@ -857,13 +857,13 @@ public class TypeCheckingExpVisitor exte
                                         + ", " + funcSpec.getInputArgsSchema() 
                                         + "). Please use an explicit cast.";
                                 msgCollector.collect(msg, MessageType.Error);
-                                throw new TypeCheckerException(msg, errCode, PigException.INPUT);
+                                throw new TypeCheckerException(func, msg, errCode, PigException.INPUT);
                             }
                         }
                     } catch (FrontendException fee) {
                         int errCode = 1043;
                         String msg = "Unalbe to retrieve field schema.";
-                        throw new TypeCheckerException(msg, errCode, PigException.INPUT, fee);
+                        throw new TypeCheckerException(func, msg, errCode, PigException.INPUT, fee);
                     }
                 }
             }
@@ -959,11 +959,12 @@ public class TypeCheckingExpVisitor exte
     
     /**
      * Checks to see if any field of the input schema is a byte array
+     * @param func 
      * @param s - input schema
      * @return true if found else false
      * @throws VisitorException
      */
-    private boolean byteArrayFound(Schema s) throws VisitorException {
+    private boolean byteArrayFound(UserFuncExpression func, Schema s) throws VisitorException {
         for(int i=0;i<s.size();i++){
             try {
                 FieldSchema fs=s.getField(i);
@@ -973,7 +974,7 @@ public class TypeCheckingExpVisitor exte
             } catch (FrontendException fee) {
                 int errCode = 1043;
                 String msg = "Unable to retrieve field schema.";
-                throw new TypeCheckerException(msg, errCode, PigException.INPUT, fee);
+                throw new TypeCheckerException(func, msg, errCode, PigException.INPUT, fee);
             }
         }
         return false;
@@ -981,12 +982,13 @@ public class TypeCheckingExpVisitor exte
 
     /**
      * Gets the positions in the schema which are byte arrays
+     * @param func 
      * 
      * @param s -
      *            input schema
      * @throws VisitorException
      */
-    private List<Integer> getByteArrayPositions(Schema s)
+    private List<Integer> getByteArrayPositions(UserFuncExpression func, Schema s)
             throws VisitorException {
         List<Integer> result = new ArrayList<Integer>();
         for (int i = 0; i < s.size(); i++) {
@@ -998,7 +1000,7 @@ public class TypeCheckingExpVisitor exte
             } catch (FrontendException fee) {
                 int errCode = 1043;
                 String msg = "Unable to retrieve field schema.";
-                throw new TypeCheckerException(msg, errCode, PigException.INPUT, fee);            }
+                throw new TypeCheckerException(func, msg, errCode, PigException.INPUT, fee);            }
         }
         return result;
     }
@@ -1036,7 +1038,7 @@ public class TypeCheckingExpVisitor exte
                                         + ", " + matchingSpecs.get(1).getInputArgsSchema() 
                                         + "). Please use an explicit cast.";
             msgCollector.collect(msg, MessageType.Error);
-            throw new TypeCheckerException(msg, errCode, PigException.INPUT);
+            throw new TypeCheckerException(func, msg, errCode, PigException.INPUT);
         }
         
         // exactly one matching spec - return it