pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r982747 [3/4] - in /hadoop/pig/trunk: src/org/apache/pig/ src/org/apache/pig/backend/hadoop/executionengine/ src/org/apache/pig/newplan/ src/org/apache/pig/newplan/logical/ src/org/apache/pig/newplan/logical/expression/ src/org/apache/pig/n...
Date Thu, 05 Aug 2010 19:38:54 GMT
Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanPrinter.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanPrinter.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanPrinter.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanPrinter.java Thu Aug  5 19:38:51 2010
@@ -17,11 +17,11 @@
  */
 package org.apache.pig.newplan.logical.optimizer;
 
-import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.MultiMap;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanWalker;
@@ -56,29 +56,29 @@ public class LogicalPlanPrinter extends 
 //    private String USep = "|   |\n|   ";
 //    private int levelCntr = -1;
     
-    public LogicalPlanPrinter(OperatorPlan plan, PrintStream ps) {
+    public LogicalPlanPrinter(OperatorPlan plan, PrintStream ps) throws FrontendException {
         super(plan, new ReverseDependencyOrderWalker(plan));
         stream = ps;
     }
 
-    protected LogicalExpressionVisitor getVisitor(LogicalExpressionPlan expr) {
+    protected LogicalExpressionVisitor getVisitor(LogicalExpressionPlan expr) throws FrontendException {
         return new ExprPrinter(expr, level+1, stream);
     }
 
     @Override
-    public void visit(LOLoad op) throws IOException {
+    public void visit(LOLoad op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
     }
 
     @Override
-    public void visit(LOStore op) throws IOException {
+    public void visit(LOStore op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
     }
 
     @Override
-    public void visit(LOForEach op) throws IOException {
+    public void visit(LOForEach op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         level++;
@@ -91,7 +91,7 @@ public class LogicalPlanPrinter extends 
     }
 
     @Override
-    public void visit(LOFilter op) throws IOException {
+    public void visit(LOFilter op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         LogicalExpressionVisitor v = getVisitor(op.getFilterPlan());
@@ -101,7 +101,7 @@ public class LogicalPlanPrinter extends 
     }
     
     @Override
-    public void visit(LOJoin op) throws IOException {
+    public void visit(LOJoin op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         
@@ -115,7 +115,7 @@ public class LogicalPlanPrinter extends 
     }
 
     @Override
-    public void visit(LOGenerate op) throws IOException {
+    public void visit(LOGenerate op) throws FrontendException {
         printLevel();        
         stream.println( op.toString() );
         List<LogicalExpressionPlan> plans = op.getOutputPlans();
@@ -129,13 +129,13 @@ public class LogicalPlanPrinter extends 
     }
 
     @Override
-    public void visit(LOInnerLoad op) throws IOException {
+    public void visit(LOInnerLoad op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
     }
     
     @Override
-    public void visit(LOCogroup op) throws IOException {
+    public void visit(LOCogroup op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         MultiMap<Integer,LogicalExpressionPlan> exprPlans = op.getExpressionPlans();
@@ -152,7 +152,7 @@ public class LogicalPlanPrinter extends 
     }
     
     @Override
-    public void visit(LOSplitOutput op) throws IOException {
+    public void visit(LOSplitOutput op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         LogicalExpressionVisitor v = getVisitor(op.getFilterPlan());
@@ -162,28 +162,28 @@ public class LogicalPlanPrinter extends 
     }
     
     @Override
-    public void visit(LOSplit op) throws IOException {
+    public void visit(LOSplit op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         level++;
     }
     
     @Override
-    public void visit(LOUnion op) throws IOException {
+    public void visit(LOUnion op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         level++;
     }
     
     @Override
-    public void visit(LOCross op) throws IOException {
+    public void visit(LOCross op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
         level++;
     }
     
     @Override
-    public void visit(LOSort op) throws IOException {
+    public void visit(LOSort op) throws FrontendException {
         printLevel();        
         stream.println( op.toString() );
         List<LogicalExpressionPlan> plans = op.getSortColPlans();
@@ -197,13 +197,13 @@ public class LogicalPlanPrinter extends 
     }
     
     @Override
-    public void visit(LODistinct op) throws IOException {
+    public void visit(LODistinct op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
     }
     
     @Override
-    public void visit(LOLimit op) throws IOException {
+    public void visit(LOLimit op) throws FrontendException {
         printLevel();
         stream.println( op.toString() );
     }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/ProjectionPatcher.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/ProjectionPatcher.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/ProjectionPatcher.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/ProjectionPatcher.java Thu Aug  5 19:38:51 2010
@@ -18,9 +18,9 @@
 
 package org.apache.pig.newplan.logical.optimizer;
 
-import java.io.IOException;
 import java.util.List;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.DependencyOrderWalker;
 import org.apache.pig.newplan.DepthFirstWalker;
 import org.apache.pig.newplan.OperatorPlan;
@@ -43,19 +43,19 @@ public class ProjectionPatcher implement
      */
     @Override
     public void transformed(OperatorPlan fp, OperatorPlan tp)
-            throws IOException {
+            throws FrontendException {
         ProjectionFinder pf = new ProjectionFinder(tp);
         pf.visit();
     }
     
     private static class ProjectionRewriter extends LogicalExpressionVisitor {
 
-        ProjectionRewriter(OperatorPlan p, LogicalRelationalOperator cop) {
+        ProjectionRewriter(OperatorPlan p, LogicalRelationalOperator cop) throws FrontendException {
             super(p, new DepthFirstWalker(p));
         }
         
         @Override
-        public void visit(ProjectExpression p) throws IOException {
+        public void visit(ProjectExpression p) throws FrontendException {
             // if projection is for everything, just return
             if (p.isProjectStar()) {
                 return;
@@ -86,7 +86,7 @@ public class ProjectionPatcher implement
                     }
                 }
                 if (match == -1) {
-                    throw new IOException("Couldn't find matching uid for project");
+                    throw new FrontendException("Couldn't find matching uid " + match + " for project "+p, 2229);
                 }
                 p.setColNum(match);
             }
@@ -95,12 +95,12 @@ public class ProjectionPatcher implement
     
     private static class ProjectionFinder extends AllExpressionVisitor {
 
-        public ProjectionFinder(OperatorPlan plan) {
+        public ProjectionFinder(OperatorPlan plan) throws FrontendException {
             super(plan, new DependencyOrderWalker(plan));
         }
 
         @Override
-        protected LogicalExpressionVisitor getVisitor(LogicalExpressionPlan expr) {
+        protected LogicalExpressionVisitor getVisitor(LogicalExpressionPlan expr) throws FrontendException {
             return new ProjectionRewriter(expr, currentOp);
         }
         

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaPatcher.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaPatcher.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaPatcher.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaPatcher.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.optimizer;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.optimizer.PlanTransformListener;
 
@@ -31,11 +30,11 @@ import org.apache.pig.newplan.optimizer.
 public class SchemaPatcher implements PlanTransformListener {
 
     /**
-     * @throws IOException 
+     * @throws FrontendException 
      * @link org.apache.pig.experimental.plan.optimizer.PlanTransformListener#transformed(org.apache.pig.experimental.plan.OperatorPlan, org.apache.pig.experimental.plan.OperatorPlan)
      */
     @Override
-    public void transformed(OperatorPlan fp, OperatorPlan tp) throws IOException {
+    public void transformed(OperatorPlan fp, OperatorPlan tp) throws FrontendException {
         // Walk the transformed plan and clean out the schemas and call
         // getSchema again on each node.  This will cause each node
         // to regenerate its schema from its parent.

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java Thu Aug  5 19:38:51 2010
@@ -1,9 +1,9 @@
 package org.apache.pig.newplan.logical.optimizer;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.MultiMap;
 import org.apache.pig.newplan.DependencyOrderWalker;
 import org.apache.pig.newplan.OperatorPlan;
@@ -31,18 +31,18 @@ import org.apache.pig.newplan.logical.re
 
 public class SchemaResetter extends LogicalRelationalNodesVisitor {
 
-    public SchemaResetter(OperatorPlan plan) {
+    public SchemaResetter(OperatorPlan plan) throws FrontendException {
         super(plan, new DependencyOrderWalker(plan));
     }
 
     @Override
-    public void visit(LOLoad load) throws IOException {
+    public void visit(LOLoad load) throws FrontendException {
         load.resetSchema();
         load.getSchema();
     }
 
     @Override
-    public void visit(LOFilter filter) throws IOException {
+    public void visit(LOFilter filter) throws FrontendException {
         filter.resetSchema();
         FieldSchemaResetter fsResetter = new FieldSchemaResetter(filter.getFilterPlan());
         fsResetter.visit();
@@ -50,13 +50,13 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LOStore store) throws IOException {
+    public void visit(LOStore store) throws FrontendException {
         store.resetSchema();
         store.getSchema();
     }
     
     @Override
-    public void visit(LOJoin join) throws IOException {
+    public void visit(LOJoin join) throws FrontendException {
         join.resetSchema();
         Collection<LogicalExpressionPlan> joinPlans = join.getExpressionPlans();
         for (LogicalExpressionPlan joinPlan : joinPlans) {
@@ -67,7 +67,7 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LOForEach foreach) throws IOException {
+    public void visit(LOForEach foreach) throws FrontendException {
         foreach.resetSchema();
         OperatorPlan innerPlan = foreach.getInnerPlan();
         PlanWalker newWalker = currentWalker.spawnChildWalker(innerPlan);
@@ -78,7 +78,7 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LOGenerate gen) throws IOException {
+    public void visit(LOGenerate gen) throws FrontendException {
         gen.resetSchema();
         List<LogicalExpressionPlan> genPlans = gen.getOutputPlans();
         for (LogicalExpressionPlan genPlan : genPlans) {
@@ -89,14 +89,14 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LOInnerLoad load) throws IOException {
+    public void visit(LOInnerLoad load) throws FrontendException {
         load.resetSchema();
         load.getProjection().resetFieldSchema();
         load.getSchema();
     }
 
     @Override
-    public void visit(LOCogroup loCogroup) throws IOException {
+    public void visit(LOCogroup loCogroup) throws FrontendException {
         loCogroup.resetSchema();
         MultiMap<Integer, LogicalExpressionPlan> expPlans = loCogroup.getExpressionPlans();
         for (LogicalExpressionPlan expPlan : expPlans.values()) {
@@ -107,13 +107,13 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LOSplit loSplit) throws IOException {
+    public void visit(LOSplit loSplit) throws FrontendException {
         loSplit.resetSchema();
         loSplit.getSchema();
     }
     
     @Override
-    public void visit(LOSplitOutput loSplitOutput) throws IOException {
+    public void visit(LOSplitOutput loSplitOutput) throws FrontendException {
         loSplitOutput.resetSchema();
         FieldSchemaResetter fsResetter = new FieldSchemaResetter(loSplitOutput.getFilterPlan());
         fsResetter.visit();
@@ -121,13 +121,13 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LOUnion loUnion) throws IOException {
+    public void visit(LOUnion loUnion) throws FrontendException {
         loUnion.resetSchema();
         loUnion.getSchema();
     }
     
     @Override
-    public void visit(LOSort loSort) throws IOException {
+    public void visit(LOSort loSort) throws FrontendException {
         loSort.resetSchema();
         List<LogicalExpressionPlan> sortPlans = loSort.getSortColPlans();
         for (LogicalExpressionPlan sortPlan : sortPlans) {
@@ -138,25 +138,25 @@ public class SchemaResetter extends Logi
     }
     
     @Override
-    public void visit(LODistinct loDistinct) throws IOException {
+    public void visit(LODistinct loDistinct) throws FrontendException {
         loDistinct.resetSchema();
         loDistinct.getSchema();
     }
     
     @Override
-    public void visit(LOLimit loLimit) throws IOException {
+    public void visit(LOLimit loLimit) throws FrontendException {
         loLimit.resetSchema();
         loLimit.getSchema();
     }
     
     @Override
-    public void visit(LOCross loCross) throws IOException {
+    public void visit(LOCross loCross) throws FrontendException {
         loCross.resetSchema();
         loCross.getSchema();
     }
     
     @Override
-    public void visit(LOStream loStream) throws IOException {
+    public void visit(LOStream loStream) throws FrontendException {
         loStream.resetSchema();
         loStream.getSchema();
     }
@@ -164,12 +164,12 @@ public class SchemaResetter extends Logi
 
 class FieldSchemaResetter extends AllSameExpressionVisitor {
 
-    protected FieldSchemaResetter(OperatorPlan p) {
+    protected FieldSchemaResetter(OperatorPlan p) throws FrontendException {
         super(p, new DependencyOrderWalker(p));
     }
 
     @Override
-    protected void execute(LogicalExpression op) throws IOException {
+    protected void execute(LogicalExpression op) throws FrontendException {
         op.resetFieldSchema();
         op.getFieldSchema();
     }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCogroup.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCogroup.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCogroup.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCogroup.java Thu Aug  5 19:38:51 2010
@@ -18,7 +18,6 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -28,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.MultiMap;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
@@ -86,35 +86,27 @@ public class LOCogroup extends LogicalRe
      * @param exprPlan ExpressionPlan which generates this field
      * @return
      */
-    private LogicalFieldSchema getPlanSchema( LogicalExpressionPlan exprPlan ) {
+    private LogicalFieldSchema getPlanSchema( LogicalExpressionPlan exprPlan ) throws FrontendException {
         LogicalExpression sourceExp = (LogicalExpression) exprPlan.getSources().get(0);
         LogicalFieldSchema planSchema = null;
-        try {
-            planSchema = sourceExp.getFieldSchema().deepCopy();
-            planSchema.uid = -1;
-        } catch (IOException e) {
-        }
+        planSchema = sourceExp.getFieldSchema().deepCopy();
+        planSchema.uid = -1;
         return planSchema;
     }
 
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         // if schema is calculated before, just return
         if (schema != null) {
             return schema;
         }
 
         List<Operator> inputs = null;
-        try {
-            inputs = plan.getPredecessors(this);
-            if (inputs == null) {
-                return null;
-            }
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessors of " + name 
-                    + " operator. ", e);
+        inputs = plan.getPredecessors(this);
+        if (inputs == null) {
+            throw new FrontendException("Cannot get predecessor for " + this, 2233);
         }
-
+        
         List<LogicalFieldSchema> fieldSchemaList = new ArrayList<LogicalFieldSchema>();
 
         // See if we have more than one expression plans, if so the
@@ -172,16 +164,11 @@ public class LOCogroup extends LogicalRe
             }
         }
         
-        try {
-            if (groupKeySchema==null) {
-                // Something wrong
-                return null;
-            }
-            groupKeyUidOnlySchema = groupKeySchema.mergeUid(groupKeyUidOnlySchema);
-        } catch (IOException e) {
-            // TODO
-            // ADD Exception
+        if (groupKeySchema==null) {
+            throw new FrontendException("Cannot get group key schema for " + this, 2234);
         }
+        groupKeyUidOnlySchema = groupKeySchema.mergeUid(groupKeyUidOnlySchema);
+
         fieldSchemaList.add( groupKeySchema );
 
         // Generate the Bag Schema
@@ -221,15 +208,15 @@ public class LOCogroup extends LogicalRe
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOCogroup) {
             LOCogroup oc = (LOCogroup)other;
             if( mGroupType == oc.mGroupType && 
@@ -251,8 +238,8 @@ public class LOCogroup extends LogicalRe
 
                     if(! ( exp1 instanceof ArrayList<?> 
                     || exp2 instanceof ArrayList<?> ) ) {
-                        throw new RuntimeException( "Expected an ArrayList " +
-                        "of Expression Plans" );
+                        throw new FrontendException( "Expected an ArrayList " +
+                        "of Expression Plans", 2235 );
                     }
 
                     ArrayList<LogicalExpressionPlan> expList1 = 

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCross.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCross.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCross.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCross.java Thu Aug  5 19:38:51 2010
@@ -17,10 +17,10 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 
@@ -35,20 +35,16 @@ public class LOCross extends LogicalRela
     }
 
     @Override
-    public LogicalSchema getSchema() {        
+    public LogicalSchema getSchema() throws FrontendException {        
         // if schema is calculated before, just return
         if (schema != null) {
             return schema;
         }
         
         List<Operator> inputs = null;
-        try {
-            inputs = plan.getPredecessors(this);
-            if (inputs == null) {
-                return null;
-            }
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessors of LOCross operator. ", e);
+        inputs = plan.getPredecessors(this);
+        if (inputs == null) {
+            return null;
         }
         
         List<LogicalSchema.LogicalFieldSchema> fss = new ArrayList<LogicalSchema.LogicalFieldSchema>();
@@ -82,15 +78,15 @@ public class LOCross extends LogicalRela
     }   
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOCross) {
             return checkEquality((LogicalRelationalOperator)other);
         } else {

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LODistinct.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LODistinct.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LODistinct.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LODistinct.java Thu Aug  5 19:38:51 2010
@@ -17,8 +17,7 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 
@@ -33,27 +32,23 @@ public class LODistinct extends LogicalR
     }
 
     @Override
-    public LogicalSchema getSchema() {      
+    public LogicalSchema getSchema() throws FrontendException {      
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LODistinct.", e);
-        }
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         
         return input.getSchema();
     }   
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LODistinct) { 
             return checkEquality((LogicalRelationalOperator)other);
         } else {

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOFilter.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOFilter.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOFilter.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOFilter.java Thu Aug  5 19:38:51 2010
@@ -17,10 +17,7 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
-//import org.apache.commons.logging.Log;
-//import org.apache.commons.logging.LogFactory;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
@@ -29,8 +26,6 @@ public class LOFilter extends LogicalRel
 
     private static final long serialVersionUID = 2L;
     private LogicalExpressionPlan filterPlan;
-    //private static Log log = LogFactory.getLog(LOFilter.class);
-
         
     public LOFilter(LogicalPlan plan) {
         super("LOFilter", plan);       
@@ -50,27 +45,22 @@ public class LOFilter extends LogicalRel
     }
     
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOFilter.", e);
-        }
-        
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         return input.getSchema();
     }   
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOFilter) { 
             LOFilter of = (LOFilter)other;
             return filterPlan.isEqual(of.filterPlan) && checkEquality(of);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOForEach.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOForEach.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOForEach.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOForEach.java Thu Aug  5 19:38:51 2010
@@ -17,10 +17,10 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
@@ -45,7 +45,7 @@ public class LOForEach extends LogicalRe
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (!(other instanceof LOForEach)) {
             return false;
         }
@@ -54,7 +54,7 @@ public class LOForEach extends LogicalRe
     }
        
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         List<Operator> ll = innerPlan.getSinks();
         if (ll != null) {
             schema = ((LogicalRelationalOperator)ll.get(0)).getSchema();
@@ -64,14 +64,14 @@ public class LOForEach extends LogicalRe
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2222);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
-    public static List<LOInnerLoad> findReacheableInnerLoadFromBoundaryProject(ProjectExpression project) throws IOException {
+    public static List<LOInnerLoad> findReacheableInnerLoadFromBoundaryProject(ProjectExpression project) throws FrontendException {
         LogicalRelationalOperator referred = project.findReferent();
         List<Operator> srcs = referred.getPlan().getSources();
         List<LOInnerLoad> innerLoads = new ArrayList<LOInnerLoad>();

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOGenerate.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOGenerate.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOGenerate.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOGenerate.java Thu Aug  5 19:38:51 2010
@@ -17,11 +17,11 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
@@ -40,7 +40,7 @@ public class LOGenerate extends LogicalR
     }
 
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         if (schema != null) {
             return schema;
         }
@@ -51,11 +51,7 @@ public class LOGenerate extends LogicalR
             LogicalExpression exp = (LogicalExpression)outputPlans.get(i).getSources().get(0);
             
             LogicalFieldSchema fieldSchema = null;
-            try {
-                fieldSchema = exp.getFieldSchema().deepCopy();
-            } catch (IOException e) {
-                return null;
-            }
+            fieldSchema = exp.getFieldSchema().deepCopy();
             
             if (fieldSchema.type != DataType.TUPLE && fieldSchema.type != DataType.BAG) {
                 // if type is primitive, just add to schema
@@ -107,7 +103,7 @@ public class LOGenerate extends LogicalR
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (!(other instanceof LOGenerate)) {
             return false;
         }
@@ -133,10 +129,10 @@ public class LOGenerate extends LogicalR
     }
   
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
          if (!(v instanceof LogicalRelationalNodesVisitor)) {
-                throw new IOException("Expected LogicalPlanVisitor");
-            }
-            ((LogicalRelationalNodesVisitor)v).visit(this);
+             throw new FrontendException("Expected LogicalPlanVisitor", 2223);
+         }
+         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java Thu Aug  5 19:38:51 2010
@@ -17,9 +17,8 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
 import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
@@ -50,32 +49,28 @@ public class LOInnerLoad extends Logical
     }
 
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         if (schema!=null)
             return schema;
         
-        try {
-            if (prj.getFieldSchema()!=null) {
-                schema = new LogicalSchema();
-                if (prj.getFieldSchema().type==DataType.BAG && prj.getFieldSchema().schema.isTwoLevelAccessRequired()) {
-                    LogicalFieldSchema tupleSchema = prj.getFieldSchema().schema.getField(0);
-                    for (int i=0;i<tupleSchema.schema.size();i++)
-                        schema.addField(tupleSchema.schema.getField(i));
-                    sourceIsBag = true;
-                    alias = prj.getFieldSchema().alias;
-                }
-                else if (prj.getFieldSchema().type==DataType.BAG){
-                    for (int i=0;i<prj.getFieldSchema().schema.size();i++)
-                        schema.addField(prj.getFieldSchema().schema.getField(i));
-                    sourceIsBag = true;
-                    alias = prj.getFieldSchema().alias;
-                }
-                else {
-                    schema.addField(prj.getFieldSchema());
-                }
+        if (prj.getFieldSchema()!=null) {
+            schema = new LogicalSchema();
+            if (prj.getFieldSchema().type==DataType.BAG && prj.getFieldSchema().schema.isTwoLevelAccessRequired()) {
+                LogicalFieldSchema tupleSchema = prj.getFieldSchema().schema.getField(0);
+                for (int i=0;i<tupleSchema.schema.size();i++)
+                    schema.addField(tupleSchema.schema.getField(i));
+                sourceIsBag = true;
+                alias = prj.getFieldSchema().alias;
+            }
+            else if (prj.getFieldSchema().type==DataType.BAG){
+                for (int i=0;i<prj.getFieldSchema().schema.size();i++)
+                    schema.addField(prj.getFieldSchema().schema.getField(i));
+                sourceIsBag = true;
+                alias = prj.getFieldSchema().alias;
+            }
+            else {
+                schema.addField(prj.getFieldSchema());
             }
-        } catch (IOException e) {
-            // TODO
         }
         return schema;
     }
@@ -85,7 +80,7 @@ public class LOInnerLoad extends Logical
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (!(other instanceof LOInnerLoad)) {
             return false;
         }
@@ -94,9 +89,9 @@ public class LOInnerLoad extends Logical
     }    
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
          if (!(v instanceof LogicalRelationalNodesVisitor)) {
-             throw new IOException("Expected LogicalPlanVisitor");
+             throw new FrontendException("Expected LogicalPlanVisitor", 2223);
          }
          ((LogicalRelationalNodesVisitor)v).visit(this);
     }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOJoin.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOJoin.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOJoin.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOJoin.java Thu Aug  5 19:38:51 2010
@@ -17,14 +17,12 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-//import org.apache.commons.logging.Log;
-//import org.apache.commons.logging.LogFactory;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.MultiMap;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
@@ -97,20 +95,16 @@ public class LOJoin extends LogicalRelat
     }
     
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         // if schema is calculated before, just return
         if (schema != null) {
             return schema;
         }
         
         List<Operator> inputs = null;
-        try {
-            inputs = plan.getPredecessors(this);
-            if (inputs == null) {
-                return null;
-            }
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessors of LOJoin operator. ", e);
+        inputs = plan.getPredecessors(this);
+        if (inputs == null) {
+            return null;
         }
         
         List<LogicalSchema.LogicalFieldSchema> fss = new ArrayList<LogicalSchema.LogicalFieldSchema>();
@@ -144,16 +138,16 @@ public class LOJoin extends LogicalRelat
     }
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
 
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOJoin) {
             LOJoin oj = (LOJoin)other;
             if (mJoinType != oj.mJoinType) return false;
@@ -182,8 +176,8 @@ public class LOJoin extends LogicalRelat
                     if (c.size() != oc.size()) return false;
                     
                     if (!(c instanceof List) || !(oc instanceof List)) {
-                        throw new RuntimeException(
-                            "Expected list of expression plans");
+                        throw new FrontendException(
+                            "Expected list of expression plans", 2238);
                     }
                     List<LogicalExpressionPlan> elist = (List<LogicalExpressionPlan>)c;
                     List<LogicalExpressionPlan> oelist = (List<LogicalExpressionPlan>)oc;

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLimit.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLimit.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLimit.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLimit.java Thu Aug  5 19:38:51 2010
@@ -17,8 +17,7 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 
@@ -44,27 +43,23 @@ public class LOLimit extends LogicalRela
     }
     
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOLimit.", e);
-        }
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         
         return input.getSchema();
     }   
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException{
         if (other != null && other instanceof LOLimit && ((LOLimit)other).getLimit() == mLimit)
             return checkEquality((LogicalRelationalOperator)other);
         else

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLoad.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLoad.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLoad.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLoad.java Thu Aug  5 19:38:51 2010
@@ -18,7 +18,6 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
@@ -26,6 +25,7 @@ import org.apache.pig.LoadFunc;
 import org.apache.pig.data.DataType;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.io.FileSpec;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 
@@ -54,7 +54,7 @@ public class LOLoad extends LogicalRelat
        this.conf = conf;
     }
     
-    public LoadFunc getLoadFunc() {
+    public LoadFunc getLoadFunc() throws FrontendException {
         try { 
             if (loadFunc == null) {
                 loadFunc = (LoadFunc)PigContext.instantiateFuncFromSpec(fs.getFuncSpec());
@@ -63,7 +63,7 @@ public class LOLoad extends LogicalRelat
             
             return loadFunc;
         }catch (ClassCastException cce) {
-            throw new RuntimeException(fs.getFuncSpec() + " should implement the LoadFunc interface.");    		
+            throw new FrontendException(fs.getFuncSpec() + " should implement the LoadFunc interface.", 2236);    		
         }
     }
     
@@ -83,7 +83,7 @@ public class LOLoad extends LogicalRelat
      * @return schema, or null if unknown
      */
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         if (schema != null)
             return schema;
         
@@ -113,11 +113,7 @@ public class LOLoad extends LogicalRelat
         }
         
         if (originalSchema!=null) {
-            try {
-                uidOnlySchema = originalSchema.mergeUid(uidOnlySchema);
-            } catch (IOException e) {
-                //TODO Exception
-            }
+            uidOnlySchema = originalSchema.mergeUid(uidOnlySchema);
         }
         
         if (requiredFields!=null) {
@@ -141,9 +137,9 @@ public class LOLoad extends LogicalRelat
     }
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
 
@@ -154,7 +150,7 @@ public class LOLoad extends LogicalRelat
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOLoad) {
             LOLoad ol = (LOLoad)other;
             if (!checkEquality(ol)) return false;

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSort.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSort.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSort.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSort.java Thu Aug  5 19:38:51 2010
@@ -17,7 +17,6 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -25,6 +24,7 @@ import java.util.List;
 import org.apache.pig.FuncSpec;
 import org.apache.pig.SortColInfo;
 import org.apache.pig.SortInfo;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
@@ -96,26 +96,22 @@ public class LOSort extends LogicalRelat
     }
 
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        } catch (IOException e) {
-            throw new RuntimeException("Unable to get predecessor of LOSort.", e);
-        }
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         return input.getSchema();
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
         
     }
     
-    public SortInfo getSortInfo() throws IOException {
+    public SortInfo getSortInfo() throws FrontendException {
         LogicalSchema schema = this.getSchema();
         List<SortColInfo> sortColInfoList = new ArrayList<SortColInfo>();
         for (int i = 0; i < mSortColPlans.size(); i++) {
@@ -126,7 +122,7 @@ public class LOSort extends LogicalRelat
                 opsList.add(opsIterator.next());
             }
             if(opsList.size() != 1 || !(opsList.get(0) instanceof ProjectExpression)) {
-                throw new IOException("Unsupported operator in inner plan: " + opsList.get(0));
+                throw new FrontendException("Unsupported operator in inner plan: " + opsList.get(0), 2237);
             }
             ProjectExpression project = (ProjectExpression) opsList.get(0);
             int sortColIndex = project.getColNum();
@@ -140,7 +136,7 @@ public class LOSort extends LogicalRelat
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOSort) {
             LOSort otherSort = (LOSort)other;
             if (!mAscCols.equals(otherSort.getAscendingCols()))

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplit.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplit.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplit.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplit.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
@@ -31,27 +30,23 @@ public class LOSplit extends LogicalRela
     }
 
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOSplit.", e);
-        }
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         
         return input.getSchema();
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOSplit) { 
             return checkEquality((LOSplit)other);
         } else {

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplitOutput.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplitOutput.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplitOutput.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplitOutput.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.logical.expression.LogicalExpressionPlan;
@@ -44,27 +43,23 @@ public class LOSplitOutput extends Logic
     }
     
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOSplit.", e);
-        }
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         
         return input.getSchema();
     }   
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOSplitOutput) { 
             LOSplitOutput os = (LOSplitOutput)other;
             return filterPlan.isEqual(os.filterPlan) && checkEquality(os);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStore.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStore.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStore.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStore.java Thu Aug  5 19:38:51 2010
@@ -17,13 +17,12 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
 //import org.apache.commons.logging.Log;
 //import org.apache.commons.logging.LogFactory;
 import org.apache.pig.StoreFuncInterface;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.io.FileSpec;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.PlanVisitor;
 
@@ -43,12 +42,7 @@ public class LOStore extends LogicalRela
         super("LOStore", plan);
 
         output = outputFileSpec;
-      
-        try { 
-             storeFunc = (StoreFuncInterface) PigContext.instantiateFuncFromSpec(outputFileSpec.getFuncSpec()); 
-        } catch (Exception e) { 
-            throw new RuntimeException("Failed to instantiate StoreFunc.", e);
-        }
+        storeFunc = (StoreFuncInterface) PigContext.instantiateFuncFromSpec(outputFileSpec.getFuncSpec()); 
     }
     
     public FileSpec getOutputSpec() {
@@ -60,25 +54,21 @@ public class LOStore extends LogicalRela
     }
     
     @Override
-    public LogicalSchema getSchema() {
-        try {
-            schema = ((LogicalRelationalOperator)plan.getPredecessors(this).get(0)).getSchema();
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOStore.", e);
-        }
+    public LogicalSchema getSchema() throws FrontendException {
+        schema = ((LogicalRelationalOperator)plan.getPredecessors(this).get(0)).getSchema();
         return schema;
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOStore) {
             LOStore os = (LOStore)other;
             if (!checkEquality(os)) return false;

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStream.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStream.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStream.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStream.java Thu Aug  5 19:38:51 2010
@@ -17,8 +17,7 @@
  */
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.streaming.ExecutableManager;
 import org.apache.pig.impl.streaming.StreamingCommand;
 import org.apache.pig.newplan.Operator;
@@ -58,30 +57,26 @@ public class LOStream extends LogicalRel
     }
 
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         if (schema!=null)
             return schema;
         LogicalRelationalOperator input = null;
-        try {
-            input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOStream.", e);
-        }
+        input = (LogicalRelationalOperator)plan.getPredecessors(this).get(0);
         
         schema = input.getSchema();
         return schema;
     }   
     
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOStream) { 
             return checkEquality((LogicalRelationalOperator)other);
         } else {

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOUnion.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOUnion.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOUnion.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOUnion.java Thu Aug  5 19:38:51 2010
@@ -18,12 +18,12 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.Pair;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
@@ -39,16 +39,12 @@ public class LOUnion extends LogicalRela
         super("LOUnion", plan);
     }    
     @Override
-    public LogicalSchema getSchema() {
+    public LogicalSchema getSchema() throws FrontendException {
         if (schema != null) {
             return schema;
         }
         List<Operator> inputs = null;
-        try {
-            inputs = plan.getPredecessors(this);
-        }catch(Exception e) {
-            throw new RuntimeException("Unable to get predecessor of LOUnion.", e);
-        }
+        inputs = plan.getPredecessors(this);
         
         // If any predecessor's schema is null, or length of predecessor's schema does not match,
         // then the schema for union is null
@@ -101,15 +97,15 @@ public class LOUnion extends LogicalRela
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalRelationalNodesVisitor)) {
-            throw new IOException("Expected LogicalPlanVisitor");
+            throw new FrontendException("Expected LogicalPlanVisitor", 2223);
         }
         ((LogicalRelationalNodesVisitor)v).visit(this);
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof LOUnion) { 
             return checkEquality((LOUnion)other);
         } else {

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogToPhyTranslationVisitor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogToPhyTranslationVisitor.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogToPhyTranslationVisitor.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogToPhyTranslationVisitor.java Thu Aug  5 19:38:51 2010
@@ -83,7 +83,7 @@ import org.apache.pig.newplan.logical.re
 
 public class LogToPhyTranslationVisitor extends LogicalRelationalNodesVisitor {
     
-    public LogToPhyTranslationVisitor(OperatorPlan plan) {
+    public LogToPhyTranslationVisitor(OperatorPlan plan) throws FrontendException {
         super(plan, new DependencyOrderWalker(plan));
         currentPlan = new PhysicalPlan();
         logToPhyMap = new HashMap<Operator, PhysicalOperator>();
@@ -109,7 +109,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOLoad loLoad) throws IOException {
+    public void visit(LOLoad loLoad) throws FrontendException {
         String scope = DEFAULT_SCOPE;
 //        System.err.println("Entering Load");
         // The last parameter here is set to true as we assume all files are 
@@ -143,7 +143,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOFilter filter) throws IOException {
+    public void visit(LOFilter filter) throws FrontendException {
         String scope = DEFAULT_SCOPE;
 //        System.err.println("Entering Filter");
         POFilter poFilter = new POFilter(new OperatorKey(scope, nodeGen
@@ -191,7 +191,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOSort sort) throws IOException {
+    public void visit(LOSort sort) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         List<LogicalExpressionPlan> logPlans = sort.getSortColPlans();
         List<PhysicalPlan> sortPlans = new ArrayList<PhysicalPlan>(logPlans.size());
@@ -248,15 +248,11 @@ public class LogToPhyTranslationVisitor 
         }
 
         poSort.setResultType(DataType.BAG);
-        try {
-            poSort.setSortInfo(sort.getSortInfo());
-        } catch (FrontendException e) {
-            throw new LogicalToPhysicalTranslatorException(e);
-        }
+        poSort.setSortInfo(sort.getSortInfo());
     }
     
     @Override
-    public void visit(LOCross cross) throws IOException {
+    public void visit(LOCross cross) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         List<Operator> inputs = cross.getPlan().getPredecessors(cross);
         
@@ -389,7 +385,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOStream stream) throws IOException {
+    public void visit(LOStream stream) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         POStream poStream = new POStream(new OperatorKey(scope, nodeGen
                 .getNextNodeId(scope)), stream.getExecutableManager(), 
@@ -419,7 +415,7 @@ public class LogToPhyTranslationVisitor 
     }
 
     @Override
-    public void visit(LOInnerLoad load) throws IOException {
+    public void visit(LOInnerLoad load) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         
         POProject exprOp = new POProject(new OperatorKey(scope, nodeGen
@@ -450,7 +446,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOForEach foreach) throws IOException {
+    public void visit(LOForEach foreach) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         
         List<PhysicalPlan> innerPlans = new ArrayList<PhysicalPlan>();
@@ -498,7 +494,11 @@ public class LogToPhyTranslationVisitor 
                         currentPlan.remove(leaf);
                         logToPhyMap.remove(pred);
 
-                        ((POProject)op).setColumn( ((POProject)leaf).getColumn() );
+                        try {
+                            ((POProject)op).setColumn( ((POProject)leaf).getColumn() );
+                        } catch (ExecException e) {
+                            throw new FrontendException("Cannot get column from "+leaf, 2230, e);
+                        }
                         ((POProject)op).setStar(((POProject)leaf).isStar());
 
                     }else{                    
@@ -570,10 +570,10 @@ public class LogToPhyTranslationVisitor 
      * a list of PhysicalPlans
      * @param plans
      * @return
-     * @throws IOException 
+     * @throws FrontendException 
      */
     private List<PhysicalPlan> translateExpressionPlans(LogicalRelationalOperator loj,
-            List<LogicalExpressionPlan> plans ) throws IOException {
+            List<LogicalExpressionPlan> plans ) throws FrontendException {
         List<PhysicalPlan> exprPlans = new ArrayList<PhysicalPlan>();
         if( plans == null || plans.size() == 0 ) {
             return exprPlans;
@@ -609,7 +609,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOStore loStore) throws IOException {
+    public void visit(LOStore loStore) throws FrontendException {
         String scope = DEFAULT_SCOPE;
 //        System.err.println("Entering Store");
         POStore store = new POStore(new OperatorKey(scope, nodeGen
@@ -672,7 +672,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit( LOCogroup cg ) throws IOException {
+    public void visit( LOCogroup cg ) throws FrontendException {
         if (cg.getGroupType() == LOCogroup.GROUPTYPE.COLLECTED) {
             translateCollectedCogroup(cg);
         } else {
@@ -680,7 +680,7 @@ public class LogToPhyTranslationVisitor 
         }
     }
     
-    private void translateRegularCogroup(LOCogroup cg) throws IOException {
+    private void translateRegularCogroup(LOCogroup cg) throws FrontendException {
         List<Operator> preds = plan.getPredecessors(cg);
         
         POGlobalRearrange poGlobal = new POGlobalRearrange(new OperatorKey(
@@ -721,9 +721,8 @@ public class LogToPhyTranslationVisitor 
             try {
                 physOp.setIndex(i);
             } catch (ExecException e1) {
-                // int errCode = 2058;
                 String msg = "Unable to set index on newly create POLocalRearrange.";
-                throw new IOException(msg);
+                throw new FrontendException(msg, 2231);
             }
             if (exprPlans.size() > 1) {
                 type = DataType.TUPLE;
@@ -753,7 +752,7 @@ public class LogToPhyTranslationVisitor 
         logToPhyMap.put(cg, poPackage);
     }
     
-    private void translateCollectedCogroup(LOCogroup cg) throws IOException {
+    private void translateCollectedCogroup(LOCogroup cg) throws FrontendException {
         // can have only one input
         LogicalRelationalOperator pred = (LogicalRelationalOperator) plan.getPredecessors(cg).get(0);
         List<LogicalExpressionPlan> exprPlans = (List<LogicalExpressionPlan>) cg.getExpressionPlans().get(0);
@@ -793,7 +792,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOJoin loj) throws IOException {
+    public void visit(LOJoin loj) throws FrontendException {
         String scope = DEFAULT_SCOPE;
 //        System.err.println("Entering Join");
         
@@ -857,7 +856,7 @@ public class LogToPhyTranslationVisitor 
                         LogicalSchema s = op.getSchema();
                         // if the schema cannot be determined
                         if (s == null) {
-                            throw new FrontendException();
+                            throw new FrontendException("Cannot get schema from "+op, 2232);
                         }
                         skj.addSchema(translateSchema(s));
                     } catch (FrontendException e) {
@@ -1105,7 +1104,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOUnion loUnion) throws IOException {
+    public void visit(LOUnion loUnion) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         POUnion physOp = new POUnion(new OperatorKey(scope,nodeGen.getNextNodeId(scope)), loUnion.getRequestedParallelisam());
         physOp.setAlias(loUnion.getAlias());
@@ -1127,7 +1126,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LODistinct loDistinct) throws IOException {
+    public void visit(LODistinct loDistinct) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         PODistinct physOp = new PODistinct(new OperatorKey(scope,nodeGen.getNextNodeId(scope)), loDistinct.getRequestedParallelisam());
         physOp.setAlias(loDistinct.getAlias());
@@ -1147,7 +1146,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOLimit loLimit) throws IOException {
+    public void visit(LOLimit loLimit) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         POLimit physOp = new POLimit(new OperatorKey(scope,nodeGen.getNextNodeId(scope)), loLimit.getRequestedParallelisam());
         physOp.setLimit(loLimit.getLimit());
@@ -1168,7 +1167,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOSplit loSplit) throws IOException {
+    public void visit(LOSplit loSplit) throws FrontendException {
         String scope = DEFAULT_SCOPE;
         POSplit physOp = new POSplit(new OperatorKey(scope, nodeGen
                 .getNextNodeId(scope)), loSplit.getRequestedParallelisam());
@@ -1220,7 +1219,7 @@ public class LogToPhyTranslationVisitor 
     }
     
     @Override
-    public void visit(LOSplitOutput loSplitOutput) throws IOException {
+    public void visit(LOSplitOutput loSplitOutput) throws FrontendException {
         String scope = DEFAULT_SCOPE;
 //        System.err.println("Entering Filter");
         POFilter poFilter = new POFilter(new OperatorKey(scope, nodeGen
@@ -1296,7 +1295,7 @@ public class LogToPhyTranslationVisitor 
         
     }
 
-    private boolean validateMergeJoin(LOJoin loj) throws IOException{
+    private boolean validateMergeJoin(LOJoin loj) throws FrontendException{
         
         List<Operator> preds = plan.getPredecessors(loj);
 
@@ -1308,7 +1307,7 @@ public class LogToPhyTranslationVisitor 
         return mergeJoinValidator(preds,loj.getPlan());
     }
     
-    private boolean mergeJoinValidator(List<Operator> preds,OperatorPlan lp) throws IOException {
+    private boolean mergeJoinValidator(List<Operator> preds,OperatorPlan lp) throws FrontendException {
         
         int errCode = 1103;
         String errMsg = "Merge join only supports Filter, Foreach, filter and Load as its predecessor. Found : ";

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalPlan.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalPlan.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalPlan.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalPlan.java Thu Aug  5 19:38:51 2010
@@ -18,9 +18,9 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.io.PrintStream;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.BaseOperatorPlan;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.logical.optimizer.LogicalPlanPrinter;
@@ -47,7 +47,7 @@ public class LogicalPlan extends BaseOpe
      * in different orders but not successors in different orders.
      */
     @Override
-    public boolean isEqual(OperatorPlan other) {
+    public boolean isEqual(OperatorPlan other) throws FrontendException {
         if (other == null || !(other instanceof LogicalPlan)) {
             return false;
         }
@@ -57,7 +57,7 @@ public class LogicalPlan extends BaseOpe
     
     @Override
     public void explain(PrintStream ps, String format, boolean verbose) 
-    throws IOException {
+    throws FrontendException {
         ps.println("#-----------------------------------------------");
         ps.println("# New Logical Plan:");
         ps.println("#-----------------------------------------------");

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,10 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
+import java.util.Iterator;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
+import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanVisitor;
 import org.apache.pig.newplan.PlanWalker;
@@ -29,62 +31,62 @@ import org.apache.pig.newplan.PlanWalker
  */
 public abstract class LogicalRelationalNodesVisitor extends PlanVisitor {
 
-    protected LogicalRelationalNodesVisitor(OperatorPlan plan, PlanWalker walker) {
+    protected LogicalRelationalNodesVisitor(OperatorPlan plan, PlanWalker walker) throws FrontendException {
         super(plan, walker);
-        /*
+        
         Iterator<Operator> iter = plan.getOperators();
         while(iter.hasNext()) {
             if (!(iter.next() instanceof LogicalRelationalOperator)) {
-                throw new RuntimeException("LogicalPlanVisitor can only visit logical plan");
+                throw new FrontendException("LogicalPlanVisitor can only visit logical plan", 2240);
             }
-        }*/
+        }
     }
     
-    public void visit(LOLoad load) throws IOException {
+    public void visit(LOLoad load) throws FrontendException {
     }
 
-    public void visit(LOFilter filter) throws IOException {
+    public void visit(LOFilter filter) throws FrontendException {
     }
     
-    public void visit(LOStore store) throws IOException {
+    public void visit(LOStore store) throws FrontendException {
     }
     
-    public void visit(LOJoin join) throws IOException {
+    public void visit(LOJoin join) throws FrontendException {
     }
     
-    public void visit(LOForEach foreach) throws IOException {
+    public void visit(LOForEach foreach) throws FrontendException {
     }
     
-    public void visit(LOGenerate gen) throws IOException {
+    public void visit(LOGenerate gen) throws FrontendException {
     }
     
-    public void visit(LOInnerLoad load) throws IOException {
+    public void visit(LOInnerLoad load) throws FrontendException {
     }
 
-    public void visit(LOCogroup loCogroup) throws IOException {
+    public void visit(LOCogroup loCogroup) throws FrontendException {
     }
     
-    public void visit(LOSplit loSplit) throws IOException {
+    public void visit(LOSplit loSplit) throws FrontendException {
     }
     
-    public void visit(LOSplitOutput loSplitOutput) throws IOException {
+    public void visit(LOSplitOutput loSplitOutput) throws FrontendException {
     }
     
-    public void visit(LOUnion loUnion) throws IOException {
+    public void visit(LOUnion loUnion) throws FrontendException {
     }
     
-    public void visit(LOSort loSort) throws IOException {
+    public void visit(LOSort loSort) throws FrontendException {
     }
     
-    public void visit(LODistinct loDistinct) throws IOException {
+    public void visit(LODistinct loDistinct) throws FrontendException {
     }
     
-    public void visit(LOLimit loLimit) throws IOException {
+    public void visit(LOLimit loLimit) throws FrontendException {
     }
     
-    public void visit(LOCross loCross) throws IOException {
+    public void visit(LOCross loCross) throws FrontendException {
     }
     
-    public void visit(LOStream loStream) throws IOException {
+    public void visit(LOStream loStream) throws FrontendException {
     }
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalOperator.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalOperator.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalOperator.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalOperator.java Thu Aug  5 19:38:51 2010
@@ -20,6 +20,7 @@ package org.apache.pig.newplan.logical.r
 
 import java.util.Map;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
 
@@ -62,8 +63,9 @@ abstract public class LogicalRelationalO
      * will attempt to construct it.  Therefore it is abstract since each
      * operator will need to construct its schema differently.
      * @return the schema
+     * @throws FrontendException
      */
-    abstract public LogicalSchema getSchema();
+    abstract public LogicalSchema getSchema() throws FrontendException;
     
     public void setSchema(LogicalSchema schema) {
         this.schema = schema;
@@ -132,8 +134,9 @@ abstract public class LogicalRelationalO
      * @param other LogicalRelationalOperator to compare predecessors against
      * @return true if the isEquals() methods of this node's predecessor(s) returns
      * true when invoked with other's predecessor(s).
+     * @throws FrontendException
      */
-    protected boolean checkEquality(LogicalRelationalOperator other) {
+    protected boolean checkEquality(LogicalRelationalOperator other) throws FrontendException {
         if (other == null) return false;
         LogicalSchema s = getSchema();
         LogicalSchema os = other.getSchema();

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java Thu Aug  5 19:38:51 2010
@@ -18,13 +18,13 @@
 
 package org.apache.pig.newplan.logical.relational;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.pig.data.DataType;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.Pair;
 import org.apache.pig.newplan.logical.expression.LogicalExpression;
 
@@ -111,7 +111,7 @@ public class LogicalSchema {
             }
             return true;
         }
-        public LogicalSchema.LogicalFieldSchema mergeUid(LogicalFieldSchema uidOnlyFieldSchema) throws IOException {
+        public LogicalSchema.LogicalFieldSchema mergeUid(LogicalFieldSchema uidOnlyFieldSchema) throws FrontendException {
             if (uidOnlyFieldSchema!=null && compatible(uidOnlyFieldSchema)) {
                 this.uid = uidOnlyFieldSchema.uid;
                 if (this.schema!=null) {
@@ -320,10 +320,10 @@ public class LogicalSchema {
         return twoLevelAccessRequired;
     }
 
-    public LogicalSchema mergeUid(LogicalSchema uidOnlySchema) throws IOException {
+    public LogicalSchema mergeUid(LogicalSchema uidOnlySchema) throws FrontendException {
         if (uidOnlySchema!=null) {
             if (size()!=uidOnlySchema.size()) {
-                throw new IOException("structure of schema change");
+                throw new FrontendException("Structure of schema change. Original: " + uidOnlySchema + " Now: " + this, 2239);
                 }
             for (int i=0;i<size();i++) {
                 getField(i).mergeUid(uidOnlySchema.getField(i));

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/AddForEach.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/AddForEach.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/AddForEach.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/AddForEach.java Thu Aug  5 19:38:51 2010
@@ -18,18 +18,18 @@
 
 package org.apache.pig.newplan.logical.rules;
 
-import java.io.IOException;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
-import org.apache.pig.newplan.OperatorSubPlan;
 import org.apache.pig.newplan.logical.Util;
 import org.apache.pig.newplan.logical.relational.LOFilter;
 import org.apache.pig.newplan.logical.relational.LOForEach;
+import org.apache.pig.newplan.logical.relational.LOJoin;
 import org.apache.pig.newplan.logical.relational.LOSort;
 import org.apache.pig.newplan.logical.relational.LOSplitOutput;
 import org.apache.pig.newplan.logical.relational.LogicalPlan;
@@ -43,7 +43,7 @@ public class AddForEach extends WholePla
     protected static final int STATUSNEWFOREACH = 2;
     
     public AddForEach(String n) {
-        super(n);		
+        super(n, false);		
     }
 
     @Override
@@ -53,14 +53,14 @@ public class AddForEach extends WholePla
     
     public class AddForEachTransformer extends Transformer {
         LogicalRelationalOperator opForAdd;
-        OperatorSubPlan subPlan;
 
         @Override
-        public boolean check(OperatorPlan matched) throws IOException {
+        public boolean check(OperatorPlan matched) throws FrontendException {
             Iterator<Operator> iter = matched.getOperators();
             while(iter.hasNext()) {
                 LogicalRelationalOperator op = (LogicalRelationalOperator)iter.next();
-                if ((op instanceof LOFilter||op instanceof LOSort||op instanceof LOSplitOutput) && shouldAdd(op)) {
+                if ((op instanceof LOFilter||op instanceof LOSort||op instanceof LOSplitOutput
+                        ||op instanceof LOJoin) && shouldAdd(op)) {
                     opForAdd = op;
                     return true;
                 }
@@ -71,11 +71,10 @@ public class AddForEach extends WholePla
 
         @Override
         public OperatorPlan reportChanges() {        	
-            return subPlan;
+            return currentPlan;
         }
 
-        private void addSuccessors(Operator op) throws IOException {
-            subPlan.add(op);
+        private void addSuccessors(Operator op) throws FrontendException {
             List<Operator> ll = op.getPlan().getSuccessors(op);
             if (ll != null) {
                 for(Operator suc: ll) {
@@ -85,16 +84,15 @@ public class AddForEach extends WholePla
         }
         
         @Override
-        public void transform(OperatorPlan matched) throws IOException {            
+        public void transform(OperatorPlan matched) throws FrontendException {            
             addForeach(opForAdd);
             
-            subPlan = new OperatorSubPlan(currentPlan);
             addSuccessors(opForAdd);
         }
         
         @SuppressWarnings("unchecked")
         // check if an LOForEach should be added after the logical operator
-        private boolean shouldAdd(LogicalRelationalOperator op) throws IOException {
+        private boolean shouldAdd(LogicalRelationalOperator op) throws FrontendException {
             Integer status = (Integer)op.getAnnotation(STATUS);
             if (status!=null && (status==STATUSADDED ||status==STATUSNEWFOREACH))
                 return false;
@@ -120,7 +118,7 @@ public class AddForEach extends WholePla
         }
         
         @SuppressWarnings("unchecked")
-        private void addForeach(LogicalRelationalOperator op) throws IOException {
+        private void addForeach(LogicalRelationalOperator op) throws FrontendException {
             Set<Long> outputUids = (Set<Long>)op.getAnnotation(ColumnPruneHelper.OUTPUTUIDS);
             LogicalSchema schema = op.getSchema();
             Set<Integer> columnsToDrop = new HashSet<Integer>();

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnMapKeyPrune.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnMapKeyPrune.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnMapKeyPrune.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnMapKeyPrune.java Thu Aug  5 19:38:51 2010
@@ -18,12 +18,12 @@
 
 package org.apache.pig.newplan.logical.rules;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.Pair;
 import org.apache.pig.newplan.Operator;
 import org.apache.pig.newplan.OperatorPlan;
@@ -41,7 +41,7 @@ public class ColumnMapKeyPrune extends W
     private boolean hasRun;
     
     public ColumnMapKeyPrune(String n) {
-        super(n);
+        super(n, false);
         hasRun = false;
     }
 
@@ -67,7 +67,7 @@ public class ColumnMapKeyPrune extends W
             new HashMap<LOLoad,Pair<Map<Integer,Set<String>>,Set<Integer>>>();
         
         @Override
-        public boolean check(OperatorPlan matched) throws IOException {
+        public boolean check(OperatorPlan matched) throws FrontendException {
             // only run this rule once
             if (hasRun) {
                 return false;
@@ -91,7 +91,7 @@ public class ColumnMapKeyPrune extends W
         }
         
         @SuppressWarnings("unchecked")
-        private void merge() {            
+        private void merge() throws FrontendException {            
             // combine annotations
             for( Operator source : currentPlan.getSources() ) {
                 Map<Integer,Set<String>> mapKeys = 
@@ -134,7 +134,7 @@ public class ColumnMapKeyPrune extends W
         }
 
         @Override
-        public void transform(OperatorPlan matched) throws IOException {        	            
+        public void transform(OperatorPlan matched) throws FrontendException {        	            
             merge();
             
             ColumnPruneVisitor columnPruneVisitor = new ColumnPruneVisitor(currentPlan, requiredItems, columnPrune);



Mime
View raw message