You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by sm...@apache.org on 2009/02/13 06:18:03 UTC
svn commit: r743989 - in /hadoop/pig/trunk: ./
src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/
src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/
src/org/apache/pig/tools/grunt/
Author: sms
Date: Fri Feb 13 05:18:02 2009
New Revision: 743989
URL: http://svn.apache.org/viewvc?rev=743989&view=rev
Log:
PIG-590: error handling on the backend
Modified:
hadoop/pig/trunk/CHANGES.txt
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/Launcher.java
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Utils.java
Modified: hadoop/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=743989&r1=743988&r2=743989&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Fri Feb 13 05:18:02 2009
@@ -422,3 +422,5 @@
PIG-590: error handling on the backend (sms via olgan)
+ PIG-590: error handling on the backend (sms)
+
Modified: hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/Launcher.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/Launcher.java?rev=743989&r1=743988&r2=743989&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/Launcher.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/Launcher.java Fri Feb 13 05:18:02 2009
@@ -251,6 +251,7 @@
return totalHadoopTimeSpent;
}
+
/**
*
* @param stackTraceLine The string representation of {@link Throwable#printStackTrace() printStackTrace}
@@ -343,8 +344,10 @@
String stackElementRegex = "\\s+at\\s+(\\w+(\\$\\w+)?\\.)+(\\<)?\\w+(\\>)?";
Pattern stackElementPattern = Pattern.compile(stackElementRegex);
String pigExceptionRegex = "org\\.apache\\.pig\\.";
- Pattern pigExceptionPattern = Pattern.compile(pigExceptionRegex);
-
+ Pattern pigExceptionPattern = Pattern.compile(pigExceptionRegex);
+ String moreElementRegex = "\\s+\\.\\.\\.\\s+\\d+\\s+more";
+ Pattern moreElementPattern = Pattern.compile(moreElementRegex);
+
String pigPackageRegex = "org.apache.pig";
@@ -361,6 +364,10 @@
pigException = true;
}
} else {
+ Matcher moreElementMatcher = moreElementPattern.matcher(stackTraceLines[lineNum]);
+ if(moreElementMatcher.find()) {
+ ++lineNum;
+ }
break;
}
}
@@ -515,6 +522,6 @@
lineNumber = Integer.parseInt(items[1]);
}
return new StackTraceElement(declaringClass, methodName, fileName, lineNumber);
- }
+ }
}
Modified: hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java?rev=743989&r1=743988&r2=743989&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java Fri Feb 13 05:18:02 2009
@@ -197,8 +197,21 @@
throw ee;
} catch (IOException ioe) {
int errCode = 2078;
- String msg = "Caught error from UDF: " + funcSpec.getClassName() +
- "[" + ioe.getMessage() + "]";
+ String msg = "Caught error from UDF: " + funcSpec.getClassName();
+ String footer = " [" + ioe.getMessage() + "]";
+
+ if(ioe instanceof PigException) {
+ int udfErrorCode = ((PigException)ioe).getErrorCode();
+ if(udfErrorCode != 0) {
+ errCode = udfErrorCode;
+ msg = ((PigException)ioe).getMessage();
+ } else {
+ msg += " [" + ((PigException)ioe).getMessage() + " ]";
+ }
+ } else {
+ msg += footer;
+ }
+
throw new ExecException(msg, errCode, PigException.BUG, ioe);
}
}
Modified: hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Utils.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Utils.java?rev=743989&r1=743988&r2=743989&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Utils.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/tools/grunt/Utils.java Fri Feb 13 05:18:02 2009
@@ -44,7 +44,7 @@
while (current != null && current.getCause() != null){
current = current.getCause();
- if(current instanceof PigException) {
+ if((current instanceof PigException) && (((PigException)current).getErrorCode() != 0)) {
pigException = current;
}
}