You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ol...@apache.org on 2009/02/13 02:59:30 UTC

svn commit: r743952 [3/4] - in /hadoop/pig/trunk: ./ src/org/apache/pig/ src/org/apache/pig/backend/executionengine/ src/org/apache/pig/backend/hadoop/ src/org/apache/pig/backend/hadoop/datastorage/ src/org/apache/pig/backend/hadoop/executionengine/ sr...

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleMin.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleMin.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleMin.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleMin.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,11 @@
         try {
             return min(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing min in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -69,9 +72,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Double)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);            
             }
         }
     }
@@ -84,9 +89,11 @@
             try {
                 return tfact.newTuple(min(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);            
             }
         }
     }
@@ -96,9 +103,11 @@
             try {
                 return min(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);            
             }
         }
     }
@@ -122,9 +131,9 @@
                 sawNonNull = true;
                 curMin = java.lang.Math.min(curMin, d);
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleSum.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleSum.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleSum.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/DoubleSum.java Fri Feb 13 01:59:27 2009
@@ -24,6 +24,7 @@
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
 import org.apache.pig.FuncSpec;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -44,9 +45,11 @@
         try {
             return sum(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -76,7 +79,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Double)( tp.get(0)));
             } catch (ExecException e) {
-                throw WrappedIOException.wrap("Caught exception in DoubleSum.Initial", e);
+                throw e;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -88,10 +95,13 @@
             try {
                 return tfact.newTuple(sum(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException("Caught exception in DoubleSum.Intermediate");
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
+            
         }
     }
     static public class Final extends EvalFunc<Double> {
@@ -100,9 +110,11 @@
             try {
                 return sum(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException("Caught exception in DoubleSum.Final");
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -126,9 +138,9 @@
                 sawNonNull = true;
                 sum += d;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
         

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/FloatAvg.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/FloatAvg.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/FloatAvg.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/FloatAvg.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -55,9 +56,7 @@
     
             return avg;
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 
@@ -86,12 +85,12 @@
                 t.set(0, f != null ? new Double(f) : null);
                 t.set(1, 1L);
                 return t;
-            } catch(RuntimeException t) {
-                throw new RuntimeException(t.getMessage() + ": " + input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
                 
         }
@@ -104,9 +103,11 @@
                 DataBag b = (DataBag)input.get(0);
                 return combine(b);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -130,9 +131,11 @@
                 }
                 return avg;
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -196,9 +199,9 @@
                 sawNonNull = true;
                 sum += f;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of floats.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMax.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMax.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMax.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMax.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,11 @@
          try {
             return max(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing max in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -69,9 +72,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Float)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -84,9 +89,11 @@
             try {
                 return tfact.newTuple(max(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -96,9 +103,11 @@
             try {
                 return max(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -122,9 +131,9 @@
                 sawNonNull = true;
                 curMax = java.lang.Math.max(curMax, f);
             } catch (RuntimeException exp) {
-                ExecException newE = new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing max of floats.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMin.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMin.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMin.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/FloatMin.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,11 @@
         try {
             return min(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing min in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -69,9 +72,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Float)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -84,9 +89,11 @@
             try {
                 return tfact.newTuple(min(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -96,9 +103,11 @@
             try {
                 return min(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -122,9 +131,9 @@
                 sawNonNull = true;
                 curMin = java.lang.Math.min(curMin, f);
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of floats.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/FloatSum.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/FloatSum.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/FloatSum.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/FloatSum.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -41,7 +42,11 @@
         try {
             return sum(input);
         } catch (ExecException ee) {
-            throw WrappedIOException.wrap("Caught exception in FloatSum", ee);
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -75,7 +80,11 @@
                 return tfact.newTuple(f != null ? 
                         new Double(f) : null);
             } catch (ExecException e) {
-                throw WrappedIOException.wrap("Caught exception in FloatSum.Initial", e);
+                throw e;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -87,7 +96,11 @@
             try {
                 return tfact.newTuple(sumDoubles(input));
             } catch (ExecException ee) {
-                throw WrappedIOException.wrap("Caught exception in FloatSum.Intermediate", ee);
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -97,7 +110,11 @@
             try {
                 return sumDoubles(input);                
             } catch (ExecException ee) {
-                throw WrappedIOException.wrap("Caught exception in FloatSum.Final", ee);
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -157,9 +174,9 @@
                 sawNonNull = true;
                 sum += f;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of floats.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/IntAvg.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/IntAvg.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/IntAvg.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/IntAvg.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -55,9 +56,7 @@
     
             return avg;
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 
@@ -87,12 +86,12 @@
                 t.set(0, i != null ? new Long(i): null);
                 t.set(1, 1L);
                 return t;
-            } catch(RuntimeException e) {
-                throw new RuntimeException(e.getMessage() + ": " + input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
                 
         }
@@ -105,9 +104,11 @@
                 DataBag b = (DataBag)input.get(0);
                 return combine(b);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -131,9 +132,11 @@
                 }
                 return avg;
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -201,9 +204,9 @@
                 sawNonNull = true;
                 sum += i;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of ints.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/IntMax.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/IntMax.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/IntMax.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/IntMax.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,11 @@
          try {
             return max(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing max in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -69,9 +72,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Integer)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -84,9 +89,11 @@
             try {
                 return tfact.newTuple(max(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -96,9 +103,11 @@
             try {
                 return max(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -122,9 +131,9 @@
                 sawNonNull = true;
                 curMax = java.lang.Math.max(curMax, i);
             } catch (RuntimeException exp) {
-                ExecException newE = new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing max of ints.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/IntMin.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/IntMin.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/IntMin.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/IntMin.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -41,9 +42,11 @@
         try {
             return min(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing min in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -71,9 +74,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Integer)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -86,9 +91,11 @@
             try {
                 return tfact.newTuple(min(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -98,9 +105,11 @@
             try {
                 return min(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -124,9 +133,9 @@
                 sawNonNull = true;
                 curMin = java.lang.Math.min(curMin, i);
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of floats.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/IntSum.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/IntSum.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/IntSum.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/IntSum.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -40,7 +41,11 @@
         try {
             return sum(input);
         } catch (ExecException ee) {
-            throw WrappedIOException.wrap("Caught exception in IntSum", ee);
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -75,7 +80,11 @@
                 // treat this particular input as null
                 return tfact.newTuple(null);
             } catch (ExecException e) {
-                throw WrappedIOException.wrap("Caught exception in IntSum.Initial", e);
+                throw e;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -87,7 +96,11 @@
             try {
                 return tfact.newTuple(sumLongs(input));
             } catch (ExecException ee) {
-                throw WrappedIOException.wrap("Caught exception in IntSum.Intermediate", ee);
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -97,7 +110,11 @@
             try {
                 return sumLongs(input);
             } catch (ExecException e) {
-                 throw WrappedIOException.wrap("Caught exception in IntSum.Intermediate", e);
+                 throw e;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -123,9 +140,9 @@
                 sawNonNull = true;
                 sum += l;
             }catch(RuntimeException exp) {
-                throw new ExecException(
-                        "Error processing: " +
-                        t.toString() + exp.getMessage(), exp);
+                int errCode = 2103;
+                String msg = "Problem while computing sum of longs.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 
@@ -156,9 +173,9 @@
                 sawNonNull = true;
                 sum += i;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of ints.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/IsEmpty.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/IsEmpty.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/IsEmpty.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/IsEmpty.java Fri Feb 13 01:59:27 2009
@@ -21,6 +21,7 @@
 import java.util.Map;
 
 import org.apache.pig.FilterFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.Tuple;
@@ -37,13 +38,14 @@
                 return ((DataBag)values).size() == 0;
             else if (values instanceof Map)
                 return ((Map)values).size() == 0;
-            else
-                throw new IOException("Cannot test a " +
-                    DataType.findTypeName(values) + " for emptiness.");
+            else {
+                int errCode = 2102;
+                String msg = "Cannot test a " +
+                DataType.findTypeName(values) + " for emptiness.";
+                throw new ExecException(msg, errCode, PigException.BUG);
+            }
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/LongAvg.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/LongAvg.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/LongAvg.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/LongAvg.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -55,9 +56,7 @@
     
             return avg;
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 
@@ -85,12 +84,12 @@
                 t.set(0, (Long)(tp.get(0)));
                 t.set(1, 1L);
                 return t;
-            } catch(RuntimeException t) {
-                throw new RuntimeException(t.getMessage() + ": " + input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
                 
         }
@@ -103,9 +102,11 @@
                 DataBag b = (DataBag)input.get(0);
                 return combine(b);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -129,9 +130,11 @@
                 }
                 return avg;
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing average in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -195,9 +198,9 @@
                 sawNonNull = true;
                 sum += l;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of longs.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/LongMax.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/LongMax.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/LongMax.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/LongMax.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,11 @@
          try {
             return max(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing max in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -69,9 +72,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Long)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -84,9 +89,11 @@
             try {
                 return tfact.newTuple(max(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -96,9 +103,11 @@
             try {
                 return max(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -122,10 +131,9 @@
                 sawNonNull = true;
                 curMax = java.lang.Math.max(curMax, l);
             } catch (RuntimeException exp) {
-                ExecException newE = new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing max of longs.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/LongMin.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/LongMin.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/LongMin.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/LongMin.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,11 @@
         try {
             return min(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing min in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -69,9 +72,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((Long)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);            
             }
         }
     }
@@ -84,9 +89,11 @@
             try {
                 return tfact.newTuple(min(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);            
             }
         }
     }
@@ -96,9 +103,11 @@
             try {
                 return min(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);            
             }
         }
     }
@@ -122,10 +131,9 @@
                 sawNonNull = true;
                 curMin = java.lang.Math.min(curMin, l);
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of longs.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/LongSum.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/LongSum.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/LongSum.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/LongSum.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -41,9 +42,11 @@
         try {
             return sum(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -73,7 +76,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple( (Long)tp.get(0));
             } catch (ExecException e) {
-                throw WrappedIOException.wrap("Caught exception in LongSum.Initial", e);
+                throw e;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -85,9 +92,11 @@
             try {
                 return tfact.newTuple(sum(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException("Caught exception in LongSum.Intermediate");
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -97,9 +106,11 @@
             try {
                 return sum(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException("Caught exception in LongSum.Final");
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -123,9 +134,9 @@
                 sawNonNull = true;
                 sum += l;
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of longs.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/MAX.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/MAX.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/MAX.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/MAX.java Fri Feb 13 01:59:27 2009
@@ -25,6 +25,7 @@
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
 import org.apache.pig.FuncSpec;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
@@ -46,9 +47,11 @@
          try {
             return max(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing max in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -80,9 +83,11 @@
             } catch (NumberFormatException e) {
                 return tfact.newTuple(null);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -95,9 +100,11 @@
             try {
                 return tfact.newTuple(maxDoubles(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -107,9 +114,11 @@
             try {
                 return maxDoubles(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -134,10 +143,9 @@
                 sawNonNull = true;
                 curMax = java.lang.Math.max(curMax, d);
             } catch (RuntimeException exp) {
-                ExecException newE = new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing max of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 
@@ -172,10 +180,9 @@
                 sawNonNull = true;
                 curMax = java.lang.Math.max(curMax, d);
             } catch (RuntimeException exp) {
-                ExecException newE = new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing max of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/MIN.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/MIN.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/MIN.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/MIN.java Fri Feb 13 01:59:27 2009
@@ -25,6 +25,7 @@
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
 import org.apache.pig.FuncSpec;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
@@ -46,9 +47,11 @@
         try {
             return min(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing min in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -81,9 +84,11 @@
                 // invalid input, send null
                 return tfact.newTuple(null);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -96,9 +101,11 @@
             try {
                 return tfact.newTuple(minDoubles(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -108,9 +115,11 @@
             try {
                 return minDoubles(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -135,10 +144,9 @@
                 sawNonNull = true;
                 curMin = java.lang.Math.min(curMin, d);
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     
@@ -173,10 +181,9 @@
                 sawNonNull = true;
                 curMin = java.lang.Math.min(curMin, d);
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/MapSize.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/MapSize.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/MapSize.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/MapSize.java Fri Feb 13 01:59:27 2009
@@ -21,6 +21,7 @@
 import java.util.Map;
 
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -38,10 +39,11 @@
             Map<Object, Object> m = (Map<Object, Object>)(input.get(0));
             return m == null ? null : new Long(m.keySet().size());
         } catch (ExecException exp) {
-            IOException oughtToBeEE = new IOException("Error processing: " +
-                input.toString() + exp.getMessage());
-            oughtToBeEE.initCause(exp);
-            throw oughtToBeEE;
+            throw exp;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing size in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);
         }
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/PigStorage.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/PigStorage.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/PigStorage.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/PigStorage.java Fri Feb 13 01:59:27 2009
@@ -31,6 +31,7 @@
 
 import org.apache.pig.ExecType;
 import org.apache.pig.LoadFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.StoreFunc;
 import org.apache.pig.ReversibleLoadStoreFunc;
 import org.apache.pig.backend.datastorage.DataStorage;
@@ -92,13 +93,11 @@
                     Integer.valueOf(delimiter.substring(2)).byteValue();
                 break;
 
-            default:
-                mLog.error("Unknown delimiter " + delimiter);
+            default:                
                 throw new RuntimeException("Unknown delimiter " + delimiter);
             }
-        } else {
-            mLog.error("PigStorage delimeter must be single character");
-            throw new RuntimeException("PigStorage delimeter must be single character");
+        } else {            
+            throw new RuntimeException("PigStorage delimeter must be a single character");
         }
     }
 
@@ -223,7 +222,7 @@
                 try {
                     putField(t.get(i));
                 } catch (ExecException ee) {
-                    throw new RuntimeException(ee);
+                    throw ee;
                 }
             }
             mOut.write(tupleEndDelim.getBytes(UTF8));
@@ -244,9 +243,12 @@
             mOut.write(bagEndDelim.getBytes(UTF8));
             break;
             
-        default:
-            throw new RuntimeException("Unknown datatype " + 
-                DataType.findType(field));
+        default: {
+            int errCode = 2108;
+            String msg = "Could not determine data type of field: " + field;
+            throw new ExecException(msg, errCode, PigException.BUG);
+        }
+        
         }
     }
 
@@ -260,7 +262,7 @@
             try {
                 field = f.get(i);
             } catch (ExecException ee) {
-                throw new RuntimeException(ee);
+                throw ee;
             }
 
             putField(field);

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/SIZE.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/SIZE.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/SIZE.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/SIZE.java Fri Feb 13 01:59:27 2009
@@ -23,6 +23,7 @@
 
 import org.apache.pig.EvalFunc;
 import org.apache.pig.FuncSpec;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataByteArray;
 import org.apache.pig.data.DataType;
@@ -42,10 +43,11 @@
             DataByteArray dba = (DataByteArray)(input.get(0));
             return dba == null ? null : new Long(dba.size());
         } catch (ExecException exp) {
-            IOException oughtToBeEE = new IOException("Error processing: " +
-                input.toString() + exp.getMessage());
-            oughtToBeEE.initCause(exp);
-            throw oughtToBeEE;
+            throw exp;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing size in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/SUM.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/SUM.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/SUM.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/SUM.java Fri Feb 13 01:59:27 2009
@@ -25,6 +25,7 @@
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
 import org.apache.pig.FuncSpec;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
@@ -46,7 +47,11 @@
         try {
             return sum(input);
         } catch (ExecException ee) {
-            throw WrappedIOException.wrap("Caught exception in SUM", ee);
+            throw ee;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);           
         }
     }
 
@@ -81,7 +86,11 @@
                 // treat this particular input as null
                 return tfact.newTuple(null);
             } catch (ExecException e) {
-                throw WrappedIOException.wrap("Caught exception in SUM.Initial", e);
+                throw e;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -93,7 +102,11 @@
             try {
                 return tfact.newTuple(sumDoubles(input));
             } catch (ExecException ee) {
-                throw WrappedIOException.wrap("Caught exception in SUM.Intermediate", ee);
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -103,7 +116,11 @@
             try {
                 return sumDoubles(input);
             } catch (ExecException ee) {
-                throw WrappedIOException.wrap("Caught exception in SUM.Final", ee);
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing sum in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);
             }
         }
     }
@@ -130,9 +147,9 @@
                 sum += d;
             
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
         
@@ -171,9 +188,9 @@
                 sum += d;
             
             }catch(RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage(), exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing sum of doubles.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
         

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java Fri Feb 13 01:59:27 2009
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -45,10 +46,11 @@
                 return null;
             } 
         } catch (ExecException exp) {
-            IOException oughtToBeEE = new IOException("Error processing: " +
-                input.toString() + exp.getMessage());
-            oughtToBeEE.initCause(exp);
-            throw oughtToBeEE;
+            throw exp;
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing concat in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);          
         }
     }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/StringMax.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/StringMax.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/StringMax.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/StringMax.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -39,9 +40,7 @@
          try {
             return max(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 
@@ -69,9 +68,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((String)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -84,9 +85,11 @@
             try {
                 return tfact.newTuple(max(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -96,9 +99,11 @@
             try {
                 return max(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing max in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -130,10 +135,9 @@
                 }
                 
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing max of strings.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/StringMin.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/StringMin.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/StringMin.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/StringMin.java Fri Feb 13 01:59:27 2009
@@ -22,6 +22,7 @@
 
 import org.apache.pig.Algebraic;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataType;
@@ -41,9 +42,7 @@
         try {
             return min(input);
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 
@@ -71,9 +70,11 @@
                 Tuple tp = bg.iterator().next();
                 return tfact.newTuple((String)(tp.get(0)));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -86,9 +87,11 @@
             try {
                 return tfact.newTuple(min(input));
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -98,9 +101,11 @@
             try {
                 return min(input);
             } catch (ExecException ee) {
-                IOException oughtToBeEE = new IOException();
-                oughtToBeEE.initCause(ee);
-                throw oughtToBeEE;
+                throw ee;
+            } catch (Exception e) {
+                int errCode = 2106;
+                String msg = "Error while computing min in " + this.getClass().getSimpleName();
+                throw new ExecException(msg, errCode, PigException.BUG, e);           
             }
         }
     }
@@ -132,10 +137,9 @@
                 }
                 
             } catch (RuntimeException exp) {
-                ExecException newE =  new ExecException("Error processing: " +
-                    t.toString() + exp.getMessage());
-                newE.initCause(exp);
-                throw newE;
+                int errCode = 2103;
+                String msg = "Problem while computing min of strings.";
+                throw new ExecException(msg, errCode, PigException.BUG, exp);
             }
         }
     

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/StringSize.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/StringSize.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/StringSize.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/StringSize.java Fri Feb 13 01:59:27 2009
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -36,10 +37,11 @@
         	String s = (String)(input.get(0));
             return s == null ? null : new Long(s.length());
         } catch (ExecException exp) {
-            IOException oughtToBeEE = new IOException("Error processing: " +
-                input.toString() + exp.getMessage());
-            oughtToBeEE.initCause(exp);
-            throw oughtToBeEE;
+            throw exp;            
+        } catch (Exception e) {
+            int errCode = 2106;
+            String msg = "Error while computing size in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);
         }
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/TOKENIZE.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/TOKENIZE.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/TOKENIZE.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/TOKENIZE.java Fri Feb 13 01:59:27 2009
@@ -21,6 +21,7 @@
 import java.util.StringTokenizer;
 
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.BagFactory;
 import org.apache.pig.data.DataBag;
@@ -40,8 +41,10 @@
             DataBag output = mBagFactory.newDefaultBag();
             Object o = input.get(0);
             if (!(o instanceof String)) {
-                throw new IOException("Expected input to be chararray, but" +
-                    " got " + o.getClass().getName());
+            	int errCode = 2114;
+            	String msg = "Expected input to be chararray, but" +
+                " got " + o.getClass().getName();
+                throw new ExecException(msg, errCode, PigException.BUG);
             }
             StringTokenizer tok = new StringTokenizer((String)o, " \",()*", false);
             while (tok.hasMoreTokens()) {
@@ -49,9 +52,7 @@
             }
             return output;
         } catch (ExecException ee) {
-            IOException oughtToBeEE = new IOException();
-            oughtToBeEE.initCause(ee);
-            throw oughtToBeEE;
+            throw ee;
         }
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/TextLoader.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/TextLoader.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/TextLoader.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/TextLoader.java Fri Feb 13 01:59:27 2009
@@ -26,7 +26,9 @@
 
 import org.apache.pig.ExecType;
 import org.apache.pig.LoadFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.datastorage.DataStorage;
+import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
 import org.apache.pig.data.Tuple;
@@ -71,7 +73,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Boolean bytesToBoolean(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Boolean");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Boolean.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
     
     /**
@@ -79,7 +83,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Integer bytesToInteger(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Integer");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Integer.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -87,7 +93,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Long bytesToLong(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Long");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Long.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -95,7 +103,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Float bytesToFloat(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Float");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Float.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -103,7 +113,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Double bytesToDouble(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Double");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Double.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -121,7 +133,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Map<Object, Object> bytesToMap(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Map");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Map.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -129,7 +143,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public Tuple bytesToTuple(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Tuple");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Tuple.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -137,7 +153,9 @@
      * @throws IOException if the value cannot be cast.
      */
     public DataBag bytesToBag(byte[] b) throws IOException {
-        throw new IOException("TextLoader does not support conversion to Bag");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion to Bag.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     /**
@@ -155,7 +173,9 @@
     }
 
     public byte[] toBytes(DataBag bag) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Bag");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Bag.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     public byte[] toBytes(String s) throws IOException {
@@ -163,26 +183,38 @@
     }
 
     public byte[] toBytes(Double d) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Double");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Double.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     public byte[] toBytes(Float f) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Float");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Float.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     public byte[] toBytes(Integer i) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Integer");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Integer.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     public byte[] toBytes(Long l) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Long");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Long.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     public byte[] toBytes(Map<Object, Object> m) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Map");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Map.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 
     public byte[] toBytes(Tuple t) throws IOException {
-        throw new IOException("TextLoader does not support conversion from Tuple");
+        int errCode = 2109;
+        String msg = "TextLoader does not support conversion from Tuple.";
+        throw new ExecException(msg, errCode, PigException.BUG);
     }
 }

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/TupleSize.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/TupleSize.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/TupleSize.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/TupleSize.java Fri Feb 13 01:59:27 2009
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 import org.apache.pig.EvalFunc;
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
@@ -39,7 +40,9 @@
             if (t == null) return null;
             return new Long(t.size());
         }catch(Exception e){
-            throw WrappedIOException.wrap(e);            
+            int errCode = 2106;
+            String msg = "Error while computing size in " + this.getClass().getSimpleName();
+            throw new ExecException(msg, errCode, PigException.BUG, e);            
         }
     }
 

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/Utf8StorageConverter.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/Utf8StorageConverter.java?rev=743952&r1=743951&r2=743952&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/Utf8StorageConverter.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/Utf8StorageConverter.java Fri Feb 13 01:59:27 2009
@@ -32,6 +32,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.hadoop.io.DataOutputBuffer;
 
+import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.data.DataBag;
 import org.apache.pig.data.DataByteArray;
@@ -77,7 +78,9 @@
         try {
             o = parseFromBytes(b);
         } catch (ParseException pe) {
-            throw new IOException(pe.getMessage());
+            int errCode = 2110;
+            String msg = "Could not convert bytearray to bag.";
+            throw new ExecException(msg, errCode, PigException.BUG);
         }
         return (DataBag)o;
     }
@@ -177,7 +180,9 @@
         try {
             o = parseFromBytes(b);
         } catch (ParseException pe) {
-            throw new IOException(pe.getMessage());
+            int errCode = 2110;
+            String msg = "Could not convert bytearray to map.";
+            throw new ExecException(msg, errCode, PigException.BUG);
         }
         return (Map<Object, Object>)o;
     }
@@ -189,7 +194,9 @@
         try {
             o = parseFromBytes(b);
         } catch (ParseException pe) {
-            throw new IOException(pe.getMessage());
+            int errCode = 2110;
+            String msg = "Could not convert bytearray to tuple.";
+            throw new ExecException(msg, errCode, PigException.BUG);
         }
         return (Tuple)o;
     }