Author: olga
Date: Fri Sep 19 17:44:42 2008
New Revision: 697308

URL: http://svn.apache.org/viewvc?rev=697308&view=rev
Log:
PIG-440: Exceptions from UDFs inside a foreach are not captured

Modified:
    incubator/pig/branches/types/CHANGES.txt
    
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
    
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java
    incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java

Modified: incubator/pig/branches/types/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/CHANGES.txt?rev=697308&r1=697307&r2=697308&view=diff
==============================================================================
--- incubator/pig/branches/types/CHANGES.txt (original)
+++ incubator/pig/branches/types/CHANGES.txt Fri Sep 19 17:44:42 2008
@@ -213,4 +213,9 @@
     PIG-364: Limit return incorrect records when we use multiple reducer
     (daijy via olgan)
 
-    PIG-439: disallow alias renaming
+    PIG-439: disallow alias renaming (pardeepk via olgan)
+
+    PIG-440: Exceptions from UDFs inside a foreach are not captured (pradeepk
+    via olgan)
+
+

Modified: 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java?rev=697308&r1=697307&r2=697308&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
 Fri Sep 19 17:44:42 2008
@@ -173,7 +173,7 @@
 
        private Result getNext() throws ExecException {
         Result result = processInput();
-        
+        String errMsg = "";
                try {
                        if(result.returnStatus == POStatus.STATUS_OK) {
                                result.result = func.exec((Tuple) 
result.result);
@@ -187,11 +187,11 @@
                        return result;
                        
                } catch (IOException e1) {
-                       log.error("Caught error from UDF " + 
funcSpec.getClassName() + 
-                "[" + e1.getMessage() + "]");
+                   errMsg = "Caught error from UDF " + funcSpec.getClassName() 
+ 
+            "[" + e1.getMessage() + "]";
+                       log.error(errMsg);
                }
-               
-               
+               result.result = errMsg;
                result.returnStatus = POStatus.STATUS_ERR;
                return result;
        }

Modified: 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java?rev=697308&r1=697307&r2=697308&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/relationalOperators/POForEach.java
 Fri Sep 19 17:44:42 2008
@@ -236,6 +236,10 @@
                     bags = null;
                     return inputData;
                 }
+                // if we see a error just return it
+                if(inputData.returnStatus == POStatus.STATUS_ERR) {
+                    return inputData;
+                }
 
 //                Object input = null;
                 

Modified: incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java?rev=697308&r1=697307&r2=697308&view=diff
==============================================================================
--- incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java 
(original)
+++ incubator/pig/branches/types/src/org/apache/pig/data/DefaultTuple.java Fri 
Sep 19 17:44:42 2008
@@ -379,7 +379,7 @@
 
     private void checkBounds(int fieldNum) throws ExecException {
         if (fieldNum >= mFields.size()) {
-            throw new ExecException("Request for field number " + fieldNum +
+            throw new ExecException("Out of bounds access: Request for field 
number " + fieldNum +
                 " exceeds tuple size of " + mFields.size());
         }
     }


Reply via email to