pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r982747 [1/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
Author: daijy
Date: Thu Aug  5 19:38:51 2010
New Revision: 982747

URL: http://svn.apache.org/viewvc?rev=982747&view=rev
Log:
PIG-1178: LogicalPlan and Optimizer are too complex and hard to work with (PIG-1178-6.patch)

Modified:
    hadoop/pig/trunk/src/org/apache/pig/PigServer.java
    hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/BaseOperatorPlan.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/DependencyOrderWalker.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstMemoryWalker.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstWalker.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/Operator.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorPlan.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorSubPlan.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/PlanVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/PlanWalker.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/ReverseDependencyOrderWalker.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/SubtreeDependencyOrderWalker.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/ForeachInnerPlanVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/LogicalPlanMigrationVistor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/Util.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AllSameExpressionVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinaryExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ExpToPhyTranslationVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanEqualExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/GreaterThanExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/IsNullExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanEqualExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/LessThanExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/LogicalExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/LogicalExpressionPlan.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/LogicalExpressionVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/MapLookupExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ModExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/MultiplyExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/NegativeExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/NotEqualExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/NotExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/OrExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ProjectExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/RegexExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/SubtractExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/UnaryExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/UserFuncExpression.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/AllExpressionVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/AllSameRalationalNodesVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/ExprPrinter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanPrinter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/ProjectionPatcher.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaPatcher.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/optimizer/SchemaResetter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCogroup.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOCross.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LODistinct.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOFilter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOForEach.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOGenerate.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOInnerLoad.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOJoin.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLimit.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOLoad.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSort.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplit.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOSplitOutput.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStore.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOStream.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LOUnion.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogToPhyTranslationVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalPlan.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalNodesVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalRelationalOperator.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/relational/LogicalSchema.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/AddForEach.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnMapKeyPrune.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneHelper.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/ColumnPruneVisitor.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/FilterAboveForeach.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/MapKeysPruneHelper.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/MergeFilter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/PushUpFilter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/SplitFilter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/TypeCastInserter.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/logical/rules/WholePlanRule.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/optimizer/PlanOptimizer.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/optimizer/PlanTransformListener.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/optimizer/Rule.java
    hadoop/pig/trunk/src/org/apache/pig/newplan/optimizer/Transformer.java
    hadoop/pig/trunk/src/org/apache/pig/tools/pigstats/JobStats.java
    hadoop/pig/trunk/src/org/apache/pig/tools/pigstats/PigStats.java
    hadoop/pig/trunk/src/org/apache/pig/tools/pigstats/ScriptState.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanColumnPrune2.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanFilterRule.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanListener.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanLogicalOptimizer.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanOperatorPlan.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestNewPlanRule.java

Modified: hadoop/pig/trunk/src/org/apache/pig/PigServer.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/PigServer.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/PigServer.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/PigServer.java Thu Aug  5 19:38:51 2010
@@ -865,6 +865,7 @@ public class PigServer {
      * @param eps Stream to print the execution tree
      * @throws IOException if the requested alias cannot be found.
      */
+    @SuppressWarnings("unchecked")
     public void explain(String alias,
                         String format,
                         boolean verbose,
@@ -888,7 +889,18 @@ public class PigServer {
                 migrator.visit();
                 org.apache.pig.newplan.logical.relational.LogicalPlan newPlan = migrator.getNewLogicalPlan();
                 
-                LogicalPlanOptimizer optimizer = new LogicalPlanOptimizer(newPlan, 3);
+                HashSet<String> optimizerRules = null;
+                try {
+                    optimizerRules = (HashSet<String>) ObjectSerializer
+                            .deserialize(pigContext.getProperties().getProperty(
+                                    "pig.optimizer.rules"));
+                } catch (IOException ioe) {
+                    int errCode = 2110;
+                    String msg = "Unable to deserialize optimizer rules.";
+                    throw new FrontendException(msg, errCode, PigException.BUG, ioe);
+                }
+                
+                LogicalPlanOptimizer optimizer = new LogicalPlanOptimizer(newPlan, 3, optimizerRules);
                 optimizer.optimize();                
                 
                 newPlan.explain(lps, format, verbose);

Modified: hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java Thu Aug  5 19:38:51 2010
@@ -18,6 +18,7 @@
 
 package org.apache.pig.backend.hadoop.executionengine;
 
+import java.io.IOException;
 import java.io.PrintStream;
 import java.net.Socket;
 import java.net.SocketException;
@@ -26,6 +27,7 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -54,9 +56,11 @@ import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.io.FileLocalizer;
 import org.apache.pig.impl.io.FileSpec;
 import org.apache.pig.impl.io.InterStorage;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.logicalLayer.LogicalPlan;
 import org.apache.pig.impl.plan.NodeIdGenerator;
 import org.apache.pig.impl.plan.OperatorKey;
+import org.apache.pig.impl.util.ObjectSerializer;
 import org.apache.pig.newplan.logical.LogicalPlanMigrationVistor;
 import org.apache.pig.newplan.logical.optimizer.SchemaResetter;
 import org.apache.pig.tools.pigstats.OutputStats;
@@ -220,6 +224,7 @@ public class HExecutionEngine {
         throw new UnsupportedOperationException();
     }
 
+    @SuppressWarnings("unchecked")
     public PhysicalPlan compile(LogicalPlan plan,
                                 Properties properties) throws ExecException {
         if (plan == null) {
@@ -240,9 +245,20 @@ public class HExecutionEngine {
                 SchemaResetter schemaResetter = new SchemaResetter(newPlan);
                 schemaResetter.visit();
                 
+                HashSet<String> optimizerRules = null;
+                try {
+                    optimizerRules = (HashSet<String>) ObjectSerializer
+                            .deserialize(pigContext.getProperties().getProperty(
+                                    "pig.optimizer.rules"));
+                } catch (IOException ioe) {
+                    int errCode = 2110;
+                    String msg = "Unable to deserialize optimizer rules.";
+                    throw new FrontendException(msg, errCode, PigException.BUG, ioe);
+                }
+                
                 // run optimizer
                 org.apache.pig.newplan.logical.optimizer.LogicalPlanOptimizer optimizer = 
-                    new org.apache.pig.newplan.logical.optimizer.LogicalPlanOptimizer(newPlan, 100);
+                    new org.apache.pig.newplan.logical.optimizer.LogicalPlanOptimizer(newPlan, 100, optimizerRules);
                 optimizer.optimize();
                 
                 // translate new logical plan to physical plan

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/BaseOperatorPlan.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/BaseOperatorPlan.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/BaseOperatorPlan.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/BaseOperatorPlan.java Thu Aug  5 19:38:51 2010
@@ -19,7 +19,6 @@
 package org.apache.pig.newplan;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -29,6 +28,7 @@ import java.util.Set;
 
 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.Pair;
 
 public abstract class BaseOperatorPlan implements OperatorPlan {
@@ -95,9 +95,8 @@ public abstract class BaseOperatorPlan i
      * @param op operator to fetch predecessors of
      * @return list of all operators imeediately before op, or an empty list
      * if op is a root.
-     * @throws IOException if op is not in the plan.
      */
-    public List<Operator> getPredecessors(Operator op) throws IOException {
+    public List<Operator> getPredecessors(Operator op) {
         return (List<Operator>)toEdges.get(op);
     }
     
@@ -106,9 +105,8 @@ public abstract class BaseOperatorPlan i
      * @param op operator to fetch successors of
      * @return list of all operators imeediately after op, or an empty list
      * if op is a leaf.
-     * @throws IOException if op is not in the plan.
      */
-    public List<Operator> getSuccessors(Operator op) throws IOException {
+    public List<Operator> getSuccessors(Operator op) {
         return (List<Operator>)fromEdges.get(op);
     }
 
@@ -125,14 +123,14 @@ public abstract class BaseOperatorPlan i
     /**
      * Remove an operator from the plan.
      * @param op Operator to be removed
-     * @throws IOException if the remove operation attempts to 
+     * @throws FrontendException if the remove operation attempts to 
      * remove an operator that is still connected to other operators.
      */
-    public void remove(Operator op) throws IOException {
+    public void remove(Operator op) throws FrontendException {
         
         if (fromEdges.containsKey(op) || toEdges.containsKey(op)) {
-            throw new IOException("Attempt to remove operator " + op.getName()
-                    + " that is still connected in the plan");
+            throw new FrontendException("Attempt to remove operator " + op.getName()
+                    + " that is still connected in the plan", 2243);
         }
         markDirty();
         ops.remove(op);
@@ -172,22 +170,22 @@ public abstract class BaseOperatorPlan i
      * @param to Operator edge is going to
      * @return pair of positions, indicating the position in the from and
      * to arrays.
-     * @throws IOException if the two operators aren't connected.
+     * @throws FrontendException if the two operators aren't connected.
      */
     public Pair<Integer, Integer> disconnect(Operator from,
-                                             Operator to) throws IOException {
+                                             Operator to) throws FrontendException {
         Pair<Operator, Integer> f = fromEdges.removeWithPosition(from, to);
         if (f == null) { 
-            throw new IOException("Attempt to disconnect operators " + 
+            throw new FrontendException("Attempt to disconnect operators " + 
                 from.getName() + " and " + to.getName() +
-                " which are not connected.");
+                " which are not connected.", 2219);
         }
         
         Pair<Operator, Integer> t = toEdges.removeWithPosition(to, from);
         if (t == null) { 
-            throw new IOException("Plan in inconssistent state " + 
+            throw new FrontendException("Plan in inconssistent state " + 
                 from.getName() + " and " + to.getName() +
-                " connected in fromEdges but not toEdges.");
+                " connected in fromEdges but not toEdges.", 2220);
         }
         
         markDirty();
@@ -203,35 +201,31 @@ public abstract class BaseOperatorPlan i
         return ops.iterator();
     }
    
-    public boolean isEqual(OperatorPlan other) {
+    public boolean isEqual(OperatorPlan other) throws FrontendException {
         return isEqual(this, other);
     }
     
     private static boolean checkPredecessors(Operator op1,
-                                      Operator op2) {
-        try {
-            List<Operator> preds = op1.getPlan().getPredecessors(op1);
-            List<Operator> otherPreds = op2.getPlan().getPredecessors(op2);
-            if (preds == null && otherPreds == null) {
-                // intentionally blank
-            } else if (preds == null || otherPreds == null) {
-                return false;
-            } else {
-                if (preds.size() != otherPreds.size()) return false;
-                for (int i = 0; i < preds.size(); i++) {
-                    Operator p1 = preds.get(i);
-                    Operator p2 = otherPreds.get(i);
-                    if (!p1.isEqual(p2)) return false;
-                    if (!checkPredecessors(p1, p2)) return false;
-                }
+                                      Operator op2) throws FrontendException {
+        List<Operator> preds = op1.getPlan().getPredecessors(op1);
+        List<Operator> otherPreds = op2.getPlan().getPredecessors(op2);
+        if (preds == null && otherPreds == null) {
+            // intentionally blank
+        } else if (preds == null || otherPreds == null) {
+            return false;
+        } else {
+            if (preds.size() != otherPreds.size()) return false;
+            for (int i = 0; i < preds.size(); i++) {
+                Operator p1 = preds.get(i);
+                Operator p2 = otherPreds.get(i);
+                if (!p1.isEqual(p2)) return false;
+                if (!checkPredecessors(p1, p2)) return false;
             }
-            return true;
-        } catch (IOException e) {
-            throw new RuntimeException(e);
         }
+        return true;
     }   
     
-    protected static boolean isEqual(OperatorPlan p1, OperatorPlan p2) {
+    protected static boolean isEqual(OperatorPlan p1, OperatorPlan p2) throws FrontendException {
         if (p1 == p2) {
             return true;
         }
@@ -260,7 +254,7 @@ public abstract class BaseOperatorPlan i
         return false;
     }
     
-    public void explain(PrintStream ps, String format, boolean verbose) throws IOException {
+    public void explain(PrintStream ps, String format, boolean verbose) throws FrontendException {
     }
     
     @Override
@@ -269,7 +263,7 @@ public abstract class BaseOperatorPlan i
         PrintStream ps = new PrintStream(os);
         try {
             explain(ps,"",false);
-        } catch (IOException e) {
+        } catch (FrontendException e) {
             return "";
         }
         return os.toString();

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/DependencyOrderWalker.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/DependencyOrderWalker.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/DependencyOrderWalker.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/DependencyOrderWalker.java Thu Aug  5 19:38:51 2010
@@ -18,13 +18,13 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.plan.VisitorException;
 
 /**
@@ -53,7 +53,7 @@ public class DependencyOrderWalker exten
      * @throws VisitorException if an error is encountered while walking.
      */
     @Override
-    public void walk(PlanVisitor visitor) throws IOException {
+    public void walk(PlanVisitor visitor) throws FrontendException {
         // This is highly inefficient, but our graphs are small so it should be okay.
         // The algorithm works by starting at any node in the graph, finding it's
         // predecessors and calling itself for each of those predecessors.  When it
@@ -77,7 +77,7 @@ public class DependencyOrderWalker exten
 
     protected void doAllPredecessors(Operator node,
                                    Set<Operator> seen,
-                                   Collection<Operator> fifo) throws IOException {
+                                   Collection<Operator> fifo) throws FrontendException {
         if (!seen.contains(node)) {
             // We haven't seen this one before.
             Collection<Operator> preds = plan.getPredecessors(node);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstMemoryWalker.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstMemoryWalker.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstMemoryWalker.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstMemoryWalker.java Thu Aug  5 19:38:51 2010
@@ -17,13 +17,14 @@
  */
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.Stack;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
 public class DepthFirstMemoryWalker extends DepthFirstWalker {
     
     private int level = 0;
@@ -46,10 +47,10 @@ public class DepthFirstMemoryWalker exte
     /**
      * Begin traversing the graph.
      * @param visitor Visitor this walker is being used by.
-     * @throws IOException if an error is encountered while walking.
+     * @throws FrontendException if an error is encountered while walking.
      */
     @Override
-    public void walk(PlanVisitor visitor) throws IOException {
+    public void walk(PlanVisitor visitor) throws FrontendException {
         List<Operator> roots = plan.getSources();
         Set<Operator> seen = new HashSet<Operator>();
 
@@ -63,7 +64,7 @@ public class DepthFirstMemoryWalker exte
     private void depthFirst(Operator node,
                             Collection<Operator> successors,
                             Set<Operator> seen,
-                            PlanVisitor visitor) throws IOException {
+                            PlanVisitor visitor) throws FrontendException {
         if (successors == null) return;
         
         StringBuilder strb = new StringBuilder(); 

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstWalker.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstWalker.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstWalker.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/DepthFirstWalker.java Thu Aug  5 19:38:51 2010
@@ -18,12 +18,13 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
 /**
  * Do a depth first traversal of the graph.
  */
@@ -41,10 +42,10 @@ public class DepthFirstWalker extends Pl
     /**
      * Begin traversing the graph.
      * @param visitor Visitor this walker is being used by.
-     * @throws IOException if an error is encountered while walking.
+     * @throws FrontendException if an error is encountered while walking.
      */
     @Override
-    public void walk(PlanVisitor visitor) throws IOException {
+    public void walk(PlanVisitor visitor) throws FrontendException {
         List<Operator> roots = plan.getSources();
         Set<Operator> seen = new HashSet<Operator>();
 
@@ -54,7 +55,7 @@ public class DepthFirstWalker extends Pl
     private void depthFirst(Operator node,
                             Collection<Operator> successors,
                             Set<Operator> seen,
-                            PlanVisitor visitor) throws IOException {
+                            PlanVisitor visitor) throws FrontendException {
         if (successors == null) return;
 
         for (Operator suc : successors) {

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/Operator.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/Operator.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/Operator.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/Operator.java Thu Aug  5 19:38:51 2010
@@ -18,10 +18,11 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
 public abstract class Operator {
     
     protected String name;
@@ -38,9 +39,9 @@ public abstract class Operator {
     /**
      * Accept a visitor at this node in the graph.
      * @param v Visitor to accept.
-     * @throws IOException 
+     * @throws FrontendException 
      */
-    public abstract void accept(PlanVisitor v) throws IOException;
+    public abstract void accept(PlanVisitor v) throws FrontendException;
 
     public String getName() {
         return name;
@@ -89,5 +90,5 @@ public abstract class Operator {
      * @param operator
      * @return true if two object have equivalent properties, else false
      */
-    public abstract boolean isEqual(Operator operator);
+    public abstract boolean isEqual(Operator operator) throws FrontendException;
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorPlan.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorPlan.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorPlan.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorPlan.java Thu Aug  5 19:38:51 2010
@@ -18,10 +18,10 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.util.Pair;
 
 public interface OperatorPlan {
@@ -51,18 +51,16 @@ public interface OperatorPlan {
      * @param op operator to fetch predecessors of
      * @return list of all operators immediately before op, or an empty list
      * if op is a root.
-     * @throws IOException if op is not in the plan.
      */
-    public List<Operator> getPredecessors(Operator op) throws IOException;
+    public List<Operator> getPredecessors(Operator op);
     
     /**
      * For a given operator, get all operators immediately after it.
      * @param op operator to fetch successors of
      * @return list of all operators immediately after op, or an empty list
      * if op is a leaf.
-     * @throws IOException if op is not in the plan.
      */
-    public List<Operator> getSuccessors(Operator op) throws IOException;
+    public List<Operator> getSuccessors(Operator op);
 
     /**
      * Add a new operator to the plan.  It will not be connected to any
@@ -74,10 +72,10 @@ public interface OperatorPlan {
     /**
      * Remove an operator from the plan.
      * @param op Operator to be removed
-     * @throws IOException if the remove operation attempts to 
+     * @throws FrontendException if the remove operation attempts to 
      * remove an operator that is still connected to other operators.
      */
-    public void remove(Operator op) throws IOException;
+    public void remove(Operator op) throws FrontendException;
     
     /**
      * Connect two operators in the plan, controlling which position in the
@@ -102,9 +100,9 @@ public interface OperatorPlan {
      * @param to Operator edge is going to
      * @return pair of positions, indicating the position in the from and
      * to arrays.
-     * @throws IOException if the two operators aren't connected.
+     * @throws FrontendException if the two operators aren't connected.
      */
-    public Pair<Integer, Integer> disconnect(Operator from, Operator to) throws IOException;
+    public Pair<Integer, Integer> disconnect(Operator from, Operator to) throws FrontendException;
 
 
     /**
@@ -119,6 +117,7 @@ public interface OperatorPlan {
      * structure.
      * @param other  object to compare
      * @return boolean if both the plans are equivalent
+     * @throws FrontendException
      */
-    public boolean isEqual( OperatorPlan other );
+    public boolean isEqual( OperatorPlan other ) throws FrontendException;
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorSubPlan.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorSubPlan.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorSubPlan.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/OperatorSubPlan.java Thu Aug  5 19:38:51 2010
@@ -18,13 +18,13 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.ArrayList;
 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.impl.util.Pair;
 
 /**
@@ -51,44 +51,47 @@ public class OperatorSubPlan implements 
         return basePlan;
     }
     
+    @Override
     public void add(Operator op) {
         operators.add(op);
         leaves.clear();
         roots.clear();
     }
 
+    @Override
     public void connect(Operator from, int fromPos, Operator to, int toPos) {
         throw new UnsupportedOperationException("connect() can not be called on OperatorSubPlan");
     }
 
+    @Override
     public void connect(Operator from, Operator to) {
         throw new UnsupportedOperationException("connect() can not be called on OperatorSubPlan");
     }
 
-    public Pair<Integer, Integer> disconnect(Operator from, Operator to) throws IOException {
+    @Override
+    public Pair<Integer, Integer> disconnect(Operator from, Operator to) throws FrontendException {
         throw new UnsupportedOperationException("disconnect() can not be called on OperatorSubPlan");
     }
 
+    @Override
     public List<Operator> getSinks() {
         if (leaves.size() == 0 && operators.size() > 0) {
             for (Operator op : operators) {       
-                try {
-                    if (getSuccessors(op) == null) {
-                        leaves.add(op);
-                    }
-                }catch(Exception e) {
-                    throw new RuntimeException(e);
+                if (getSuccessors(op) == null) {
+                    leaves.add(op);
                 }
             }
         }
         return leaves;
     }
 
+    @Override
     public Iterator<Operator> getOperators() {
         return operators.iterator();
     }
 
-    public List<Operator> getPredecessors(Operator op) throws IOException {
+    @Override
+    public List<Operator> getPredecessors(Operator op) {
         List<Operator> l = basePlan.getPredecessors(op);
         List<Operator> list = null;
         if (l != null) {
@@ -105,22 +108,20 @@ public class OperatorSubPlan implements 
         return list;
     }
 
+    @Override
     public List<Operator> getSources() {
         if (roots.size() == 0 && operators.size() > 0) {
             for (Operator op : operators) {       
-                try {
-                    if (getPredecessors(op) == null) {
-                        roots.add(op);
-                    }
-                }catch(Exception e) {
-                    throw new RuntimeException(e);
+                if (getPredecessors(op) == null) {
+                    roots.add(op);
                 }
             }
         }
         return roots;
     }
 
-    public List<Operator> getSuccessors(Operator op) throws IOException {
+    @Override
+    public List<Operator> getSuccessors(Operator op) {
         List<Operator> l = basePlan.getSuccessors(op);
         List<Operator> list = null;
         if (l != null) {
@@ -137,18 +138,20 @@ public class OperatorSubPlan implements 
         return list;
     }
 
-    public void remove(Operator op) throws IOException {
+    @Override
+    public void remove(Operator op) throws FrontendException {
         operators.remove(op);
         leaves.clear();
         roots.clear();
     }
 
+    @Override
     public int size() {
         return operators.size();
     }
 
     @Override
-    public boolean isEqual(OperatorPlan other) {		
+    public boolean isEqual(OperatorPlan other) throws FrontendException {		
         return BaseOperatorPlan.isEqual(this, other);
     }    
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/PlanVisitor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/PlanVisitor.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/PlanVisitor.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/PlanVisitor.java Thu Aug  5 19:38:51 2010
@@ -18,10 +18,9 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.Stack;
 
-import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 
 /**
  * A visitor mechanism for navigating and operating on a plan of 
@@ -47,7 +46,7 @@ public abstract class PlanVisitor {
      * Entry point for visiting the plan.
      * @throws VisitorException if an error is encountered while visiting.
      */
-    public void visit() throws IOException {
+    public void visit() throws FrontendException {
         currentWalker.walk(this);
     }
 
@@ -81,9 +80,9 @@ public abstract class PlanVisitor {
      * @throws VisitorException if there are no more walkers on the stack.  In
      * this case the current walker is not reset.
      */
-    protected void popWalker() throws VisitorException {
+    protected void popWalker() throws FrontendException {
         if (walkers.empty()) {
-            throw new VisitorException("No more walkers to pop.");
+            throw new FrontendException("No more walkers to pop.", 2221);
         }
         currentWalker = walkers.pop();
     }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/PlanWalker.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/PlanWalker.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/PlanWalker.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/PlanWalker.java Thu Aug  5 19:38:51 2010
@@ -18,7 +18,7 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 
 public abstract class PlanWalker {
 
@@ -38,7 +38,7 @@ public abstract class PlanWalker {
      * not yet have a 'this' pointer to send as an argument.
      * @throws VisitorException if an error is encountered while walking.
      */
-    public abstract void walk(PlanVisitor visitor) throws IOException;
+    public abstract void walk(PlanVisitor visitor) throws FrontendException;
 
     /**
      * Return a new instance of this same type of walker for a subplan.

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/ReverseDependencyOrderWalker.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/ReverseDependencyOrderWalker.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/ReverseDependencyOrderWalker.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/ReverseDependencyOrderWalker.java Thu Aug  5 19:38:51 2010
@@ -18,13 +18,14 @@
 
 package org.apache.pig.newplan;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.pig.impl.logicalLayer.FrontendException;
+
 /**
  * Visit a plan in the reverse of the dependency order.  That is, every node
  * after every node that depends on it is visited.  Thus this is equivalent to
@@ -47,7 +48,7 @@ public class ReverseDependencyOrderWalke
      * @throws VisitorException if an error is encountered while walking.
      */
     @Override
-    public void walk(PlanVisitor visitor) throws IOException {
+    public void walk(PlanVisitor visitor) throws FrontendException {
         // This is highly inefficient, but our graphs are small so it should be okay.
         // The algorithm works by starting at any node in the graph, finding it's
         // successors and calling itself for each of those successors.  When it
@@ -71,7 +72,7 @@ public class ReverseDependencyOrderWalke
 
     protected void doAllSuccessors(Operator node,
                                    Set<Operator> seen,
-                                   Collection<Operator> fifo) throws IOException {
+                                   Collection<Operator> fifo) throws FrontendException {
         if (!seen.contains(node)) {
             // We haven't seen this one before.
             Collection<Operator> succs = plan.getSuccessors(node);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/SubtreeDependencyOrderWalker.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/SubtreeDependencyOrderWalker.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/SubtreeDependencyOrderWalker.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/SubtreeDependencyOrderWalker.java Thu Aug  5 19:38:51 2010
@@ -18,12 +18,13 @@
 
 package org.apache.pig.newplan;
 
-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;
+
 public class SubtreeDependencyOrderWalker extends DependencyOrderWalker {
     private Operator startNode;
     
@@ -36,7 +37,7 @@ public class SubtreeDependencyOrderWalke
         this.startNode = startNode;
     }
     
-    public void walk(PlanVisitor visitor) throws IOException {          
+    public void walk(PlanVisitor visitor) throws FrontendException {          
         List<Operator> fifo = new ArrayList<Operator>();
         Set<Operator> seen = new HashSet<Operator>();
 

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/ForeachInnerPlanVisitor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/ForeachInnerPlanVisitor.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/ForeachInnerPlanVisitor.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/ForeachInnerPlanVisitor.java Thu Aug  5 19:38:51 2010
@@ -17,12 +17,12 @@
  */
 package org.apache.pig.newplan.logical;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
 import org.apache.pig.impl.logicalLayer.ExpressionOperator;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.logicalLayer.LODistinct;
 import org.apache.pig.impl.logicalLayer.LOFilter;
 import org.apache.pig.impl.logicalLayer.RelationalOperator;
@@ -55,28 +55,25 @@ public class ForeachInnerPlanVisitor ext
     private HashMap<LogicalOperator, LogicalRelationalOperator> innerOpsMap;
 
     public ForeachInnerPlanVisitor(org.apache.pig.newplan.logical.relational.LOForEach foreach, LOForEach oldForeach, LogicalPlan innerPlan, 
-            LogicalPlan oldLogicalPlan) {
+            LogicalPlan oldLogicalPlan) throws FrontendException {
         super(innerPlan, foreach, oldLogicalPlan);
         newInnerPlan = foreach.getInnerPlan();
         
         // get next inputNo 
         gen = (org.apache.pig.newplan.logical.relational.LogicalRelationalOperator)
             newInnerPlan.getSinks().get(0);
-        try {
-            inputNo = 0;
-            List<org.apache.pig.newplan.Operator> suc = newInnerPlan.getPredecessors(gen);
-            if (suc != null) {
-                inputNo = suc.size();
-            }
-        }catch(Exception e) {
-            throw new RuntimeException(e);
+        inputNo = 0;
+        List<org.apache.pig.newplan.Operator> suc = newInnerPlan.getPredecessors(gen);
+        if (suc != null) {
+            inputNo = suc.size();
         }
+        
         this.oldForeach = oldForeach;
                     
         innerOpsMap = new HashMap<LogicalOperator, LogicalRelationalOperator>();
     }
     
-    private void translateInnerPlanConnection(LogicalOperator oldOp, org.apache.pig.newplan.Operator newOp) throws IOException {
+    private void translateInnerPlanConnection(LogicalOperator oldOp, org.apache.pig.newplan.Operator newOp) throws FrontendException {
         List<LogicalOperator> preds = mPlan.getPredecessors(oldOp);
         
         if(preds != null) {
@@ -131,7 +128,7 @@ public class ForeachInnerPlanVisitor ext
             exprOpsMap.put(project, pe);
             try {
                 translateInnerPlanConnection(project, pe);
-            } catch (IOException e) {
+            } catch (FrontendException e) {
                 throw new VisitorException(e);
             } 
         }
@@ -184,7 +181,7 @@ public class ForeachInnerPlanVisitor ext
         innerOpsMap.put(sort, newSort);
         try {
             translateInnerPlanConnection(sort, newSort);
-        } catch (IOException e) {
+        } catch (FrontendException e) {
             throw new VisitorException(e);
         }
         
@@ -205,7 +202,7 @@ public class ForeachInnerPlanVisitor ext
         innerOpsMap.put(limit, newLimit);
         try {
             translateInnerPlanConnection(limit, newLimit);
-        } catch (IOException e) {
+        } catch (FrontendException e) {
             throw new VisitorException(e);
         }        
     }
@@ -220,7 +217,7 @@ public class ForeachInnerPlanVisitor ext
         innerOpsMap.put(distinct, newDistinct);
         try {
             translateInnerPlanConnection(distinct, newDistinct);
-        } catch (IOException e) {
+        } catch (FrontendException e) {
             throw new VisitorException(e);
         }
     }
@@ -237,7 +234,7 @@ public class ForeachInnerPlanVisitor ext
         innerOpsMap.put(filter, newFilter);
         try {
             translateInnerPlanConnection(filter, newFilter);
-        } catch (IOException e) {
+        } catch (FrontendException e) {
             throw new VisitorException(e);
         }
     }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/LogicalPlanMigrationVistor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/LogicalPlanMigrationVistor.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/LogicalPlanMigrationVistor.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/LogicalPlanMigrationVistor.java Thu Aug  5 19:38:51 2010
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.List;
 
 import org.apache.pig.impl.io.FileSpec;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.logicalLayer.LOCogroup;
 import org.apache.pig.impl.logicalLayer.LOCross;
 import org.apache.pig.impl.logicalLayer.LODistinct;
@@ -201,12 +202,16 @@ public class LogicalPlanMigrationVistor 
         innerPlan.add(gen);                
         
         List<LogicalPlan> ll = forEach.getForEachPlans();
-        for(int i=0; i<ll.size(); i++) {
-            LogicalPlan lp = ll.get(i);
-            ForeachInnerPlanVisitor v = new ForeachInnerPlanVisitor(newForeach, forEach, lp, mPlan);
-            v.visit();
-            
-            expPlans.add(v.exprPlan);
+        try {
+            for(int i=0; i<ll.size(); i++) {
+                LogicalPlan lp = ll.get(i);
+                ForeachInnerPlanVisitor v = new ForeachInnerPlanVisitor(newForeach, forEach, lp, mPlan);
+                v.visit();
+                
+                expPlans.add(v.exprPlan);
+            }
+        } catch (FrontendException e) {
+            throw new VisitorException("Cannot create ForeachInnerPlanVisitor", e);
         }
         
         newForeach.setAlias(forEach.getAlias());

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/Util.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/Util.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/Util.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/Util.java Thu Aug  5 19:38:51 2010
@@ -17,7 +17,6 @@
  */
 package org.apache.pig.newplan.logical;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -101,7 +100,7 @@ public class Util {
     }
     
     public static LOForEach addForEachAfter(LogicalPlan plan, LogicalRelationalOperator op,
-            Set<Integer> columnsToDrop) throws IOException {
+            Set<Integer> columnsToDrop) throws FrontendException {
         LOForEach foreach = new LOForEach(plan);
         
         plan.add(foreach);
@@ -134,7 +133,7 @@ public class Util {
             innerPlan.connect(innerLoad, gen);
             
             LogicalExpressionPlan exp = new LogicalExpressionPlan();
-            ProjectExpression prj = new ProjectExpression(exp, j++, 0, gen);
+            ProjectExpression prj = new ProjectExpression(exp, j++, -1, gen);
             exp.add(prj);
             exps.add(exp);
         }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AddExpression.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -47,29 +46,25 @@ public class AddExpression extends Binar
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof AddExpression) {
             AddExpression ao = (AddExpression)other;
-            try {
-                return ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
+            return ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
         } else {
             return false;
         }
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = new LogicalSchema.LogicalFieldSchema(null, null, getLhs().getType());

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AllSameExpressionVisitor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AllSameExpressionVisitor.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AllSameExpressionVisitor.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AllSameExpressionVisitor.java Thu Aug  5 19:38:51 2010
@@ -17,14 +17,13 @@
  */
 package org.apache.pig.newplan.logical.expression;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.OperatorPlan;
 import org.apache.pig.newplan.PlanWalker;
 
 public abstract class AllSameExpressionVisitor extends LogicalExpressionVisitor {
 
-    public AllSameExpressionVisitor(OperatorPlan plan, PlanWalker walker) {
+    public AllSameExpressionVisitor(OperatorPlan plan, PlanWalker walker) throws FrontendException {
         super(plan, walker);
     }
     
@@ -32,125 +31,125 @@ public abstract class AllSameExpressionV
      * Method to call on every node in the logical expression plan.
      * @param op Node that is currently being visited.
      */
-    abstract protected void execute(LogicalExpression op) throws IOException;
+    abstract protected void execute(LogicalExpression op) throws FrontendException;
     
     @Override
-    public void visit(AndExpression andExpr) throws IOException {
+    public void visit(AndExpression andExpr) throws FrontendException {
         execute(andExpr);
     }
     
     @Override
-    public void visit(OrExpression exp) throws IOException {
+    public void visit(OrExpression exp) throws FrontendException {
         execute(exp);
     }
 
     @Override
-    public void visit(EqualExpression equal) throws IOException {
+    public void visit(EqualExpression equal) throws FrontendException {
         execute(equal);
     }
     
     @Override
-    public void visit(ProjectExpression project) throws IOException {
+    public void visit(ProjectExpression project) throws FrontendException {
         execute(project);
     }
     
     @Override
-    public void visit(ConstantExpression constant) throws IOException {
+    public void visit(ConstantExpression constant) throws FrontendException {
         execute(constant);
     }
     
     @Override
-    public void visit(CastExpression cast) throws IOException {
+    public void visit(CastExpression cast) throws FrontendException {
         execute(cast);
     }
 
     @Override
-    public void visit(GreaterThanExpression greaterThanExpression) throws IOException {
+    public void visit(GreaterThanExpression greaterThanExpression) throws FrontendException {
         execute(greaterThanExpression);
     }
     
     @Override
-    public void visit(GreaterThanEqualExpression op) throws IOException {
+    public void visit(GreaterThanEqualExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(LessThanExpression lessThanExpression) throws IOException {
+    public void visit(LessThanExpression lessThanExpression) throws FrontendException {
         execute(lessThanExpression);
     }
     
     @Override
-    public void visit(LessThanEqualExpression op) throws IOException {
+    public void visit(LessThanEqualExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(NotEqualExpression op) throws IOException {
+    public void visit(NotEqualExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(NotExpression op) throws IOException {
+    public void visit(NotExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(IsNullExpression op) throws IOException {
+    public void visit(IsNullExpression op) throws FrontendException {
         execute(op);
     }
     
     @Override
-    public void visit(NegativeExpression op) throws IOException {
+    public void visit(NegativeExpression op) throws FrontendException {
         execute(op);
     }
     
     @Override
-    public void visit(AddExpression op) throws IOException {
+    public void visit(AddExpression op) throws FrontendException {
         execute(op);
     }
     
     @Override
-    public void visit(SubtractExpression op) throws IOException {
+    public void visit(SubtractExpression op) throws FrontendException {
         execute(op);
     }
     
     @Override
-    public void visit(MultiplyExpression op) throws IOException {
+    public void visit(MultiplyExpression op) throws FrontendException {
         execute(op);
     }
     
     @Override
-    public void visit(ModExpression op) throws IOException {
+    public void visit(ModExpression op) throws FrontendException {
         execute(op);
     }
     
     @Override
-    public void visit(DivideExpression op) throws IOException {
+    public void visit(DivideExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(MapLookupExpression op) throws IOException {
+    public void visit(MapLookupExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(BinCondExpression op) throws IOException {
+    public void visit(BinCondExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(UserFuncExpression op) throws IOException {
+    public void visit(UserFuncExpression op) throws FrontendException {
         execute(op);
     }
 
     @Override
-    public void visit(DereferenceExpression derefenceExpression) throws IOException {
+    public void visit(DereferenceExpression derefenceExpression) throws FrontendException {
         execute(derefenceExpression);
     }
 
     @Override
-    public void visit(RegexExpression op) throws IOException {
+    public void visit(RegexExpression op) throws FrontendException {
         execute(op);
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/AndExpression.java Thu Aug  5 19:38:51 2010
@@ -18,9 +18,8 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -48,29 +47,25 @@ public class AndExpression extends Binar
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof AndExpression) {
             AndExpression ao = (AndExpression)other;
-            try {
-                return ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
+            return ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
         } else {
             return false;
         }
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = new LogicalSchema.LogicalFieldSchema(null, null, DataType.BOOLEAN);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinCondExpression.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -48,27 +47,27 @@ public class BinCondExpression extends L
     /**
      * Returns the operator which handles this condition
      * @return expression which handles the condition
-     * @throws IOException
+     * @throws FrontendException
      */
-    public LogicalExpression getCondition() throws IOException {
+    public LogicalExpression getCondition() throws FrontendException {
         return (LogicalExpression)plan.getSuccessors(this).get(0);
     }
 
     /**
      * Get the left hand side of this expression.
      * @return expression on the left hand side
-     * @throws IOException 
+     * @throws FrontendException 
      */
-    public LogicalExpression getLhs() throws IOException {
+    public LogicalExpression getLhs() throws FrontendException {
         return (LogicalExpression)plan.getSuccessors(this).get(1);        
     }
 
     /**
      * Get the right hand side of this expression.
      * @return expression on the right hand side
-     * @throws IOException 
+     * @throws FrontendException 
      */
-    public LogicalExpression getRhs() throws IOException {
+    public LogicalExpression getRhs() throws FrontendException {
         return (LogicalExpression)plan.getSuccessors(this).get(2);
     }
 
@@ -76,30 +75,26 @@ public class BinCondExpression extends L
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof BinCondExpression) {
             BinCondExpression ao = (BinCondExpression)other;
-            try {
-                return ao.getCondition().isEqual(getCondition()) && 
-                ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
+            return ao.getCondition().isEqual(getCondition()) && 
+            ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
         } else {
             return false;
         }
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = new LogicalSchema.LogicalFieldSchema(null, null, getLhs().getType());

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinaryExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinaryExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinaryExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/BinaryExpression.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-import java.io.IOException;
-
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.newplan.OperatorPlan;
 
 /**
@@ -49,18 +48,18 @@ public abstract class BinaryExpression e
     /**
      * Get the left hand side of this binary expression.
      * @return expression on the left hand side
-     * @throws IOException 
+     * @throws FrontendException 
      */
-    public LogicalExpression getLhs() throws IOException {
+    public LogicalExpression getLhs() throws FrontendException {
         return (LogicalExpression)plan.getSuccessors(this).get(0);        
     }
 
     /**
      * Get the right hand side of this binary expression.
      * @return expression on the right hand side
-     * @throws IOException 
+     * @throws FrontendException 
      */
-    public LogicalExpression getRhs() throws IOException {
+    public LogicalExpression getRhs() throws FrontendException {
         return (LogicalExpression)plan.getSuccessors(this).get(1);
     }    
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/CastExpression.java Thu Aug  5 19:38:51 2010
@@ -18,9 +18,8 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-import java.io.IOException;
-
 import org.apache.pig.FuncSpec;
+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;
@@ -36,9 +35,9 @@ public class CastExpression extends Unar
     }
 
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
@@ -60,21 +59,17 @@ public class CastExpression extends Unar
     }
 
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof CastExpression) { 
             CastExpression of = (CastExpression)other;
-            try {
-                return plan.isEqual(of.plan) && getExpression().isEqual( of.getExpression() );
-            } catch (IOException e) {
-                return false;
-            }
+            return plan.isEqual(of.plan) && getExpression().isEqual( of.getExpression() );
         } else {
             return false;
         }
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = new LogicalSchema.LogicalFieldSchema(null, castSchema.schema, castSchema.type);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/ConstantExpression.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -52,9 +51,9 @@ public class ConstantExpression extends 
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
 
@@ -74,7 +73,7 @@ public class ConstantExpression extends 
 
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof ConstantExpression) {
             ConstantExpression co = (ConstantExpression)other;
             return co.getValueSchema().isEqual(mValueSchema) && ( ( co.val == null && val == null ) 
@@ -85,7 +84,7 @@ public class ConstantExpression extends 
     }
     
     @Override
-    public LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = mValueSchema;

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DereferenceExpression.java Thu Aug  5 19:38:51 2010
@@ -18,11 +18,11 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -67,9 +67,9 @@ public class DereferenceExpression exten
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
@@ -83,53 +83,45 @@ public class DereferenceExpression exten
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof DereferenceExpression) {
             DereferenceExpression po = (DereferenceExpression)other;
-            try {
-                if( po.columns.size() != columns.size() ) {
-                    return false;
-                }
-                return po.columns.containsAll(columns) && getReferredExpression().isEqual(po.getReferredExpression());
-            } catch (IOException e) {
+            if( po.columns.size() != columns.size() ) {
                 return false;
             }
+            return po.columns.containsAll(columns) && getReferredExpression().isEqual(po.getReferredExpression());
         } else {
             return false;
         }
     }
     
-    public LogicalExpression getReferredExpression() throws IOException {
+    public LogicalExpression getReferredExpression() throws FrontendException {
         if( plan.getSuccessors(this).size() < 1 ) {
-            throw new IOException("Could not find a related project Expression for Dereference");
+            throw new FrontendException("Could not find a related project Expression for Dereference", 2228);
         }
         return (LogicalExpression) plan.getSuccessors(this).get(0);
     }
     
     public String toString() {
         StringBuilder msg = new StringBuilder();
-        try {
-            msg.append("(Name: " + name + " Type: ");
-            if (fieldSchema!=null)
-                msg.append(DataType.findTypeName(getFieldSchema().type));
-            else
-                msg.append("null");
-            msg.append(" Uid: ");
-            if (fieldSchema!=null)
-                msg.append(getFieldSchema().uid);
-            else
-                msg.append("null");
-            msg.append(" Column:" + columns);
-            msg.append(")");
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+        msg.append("(Name: " + name + " Type: ");
+        if (fieldSchema!=null)
+            msg.append(DataType.findTypeName(fieldSchema.type));
+        else
+            msg.append("null");
+        msg.append(" Uid: ");
+        if (fieldSchema!=null)
+            msg.append(fieldSchema.uid);
+        else
+            msg.append("null");
+        msg.append(" Column:" + columns);
+        msg.append(")");
 
         return msg.toString();
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         LogicalExpression successor = (LogicalExpression)plan.getSuccessors(this).get(0);

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/DivideExpression.java Thu Aug  5 19:38:51 2010
@@ -18,8 +18,7 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -47,29 +46,25 @@ public class DivideExpression extends Bi
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof DivideExpression) {
             DivideExpression ao = (DivideExpression)other;
-            try {
-                return ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
+            return ao.getLhs().isEqual(getLhs()) && ao.getRhs().isEqual(getRhs());
         } else {
             return false;
         }
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = new LogicalSchema.LogicalFieldSchema(null, null, getLhs().getType());

Modified: hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java?rev=982747&r1=982746&r2=982747&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/newplan/logical/expression/EqualExpression.java Thu Aug  5 19:38:51 2010
@@ -18,9 +18,8 @@
 
 package org.apache.pig.newplan.logical.expression;
 
-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;
@@ -48,31 +47,27 @@ public class EqualExpression extends Bin
      * @link org.apache.pig.experimental.plan.Operator#accept(org.apache.pig.experimental.plan.PlanVisitor)
      */
     @Override
-    public void accept(PlanVisitor v) throws IOException {
+    public void accept(PlanVisitor v) throws FrontendException {
         if (!(v instanceof LogicalExpressionVisitor)) {
-            throw new IOException("Expected LogicalExpressionVisitor");
+            throw new FrontendException("Expected LogicalExpressionVisitor", 2222);
         }
         ((LogicalExpressionVisitor)v).visit(this);
     }
     
     @Override
-    public boolean isEqual(Operator other) {
+    public boolean isEqual(Operator other) throws FrontendException {
         if (other != null && other instanceof EqualExpression) {
             EqualExpression eo = (EqualExpression)other;
-            try {
-                return eo.getLhs().isEqual(
-                        getLhs()) && 
-                eo.getRhs().isEqual(getRhs());
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
+            return eo.getLhs().isEqual(
+                    getLhs()) && 
+            eo.getRhs().isEqual(getRhs());
         } else {
             return false;
         }
     }
     
     @Override
-    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws IOException {
+    public LogicalSchema.LogicalFieldSchema getFieldSchema() throws FrontendException {
         if (fieldSchema!=null)
             return fieldSchema;
         fieldSchema = new LogicalSchema.LogicalFieldSchema(null, null, DataType.BOOLEAN);



Mime
View raw message