You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2011/10/13 23:45:57 UTC
svn commit: r1183120 - in /pig/trunk:
src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigOutputCommitter.java
test/findbugsExcludeFile.xml
Author: daijy
Date: Thu Oct 13 21:45:56 2011
New Revision: 1183120
URL: http://svn.apache.org/viewvc?rev=1183120&view=rev
Log:
PIG-2125: Make Pig work with hadoop .NEXT (PIG-2125-commitJob.patch)
Modified:
pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigOutputCommitter.java
pig/trunk/test/findbugsExcludeFile.xml
Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigOutputCommitter.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigOutputCommitter.java?rev=1183120&r1=1183119&r2=1183120&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigOutputCommitter.java (original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/PigOutputCommitter.java Thu Oct 13 21:45:56 2011
@@ -18,6 +18,7 @@
package org.apache.pig.backend.hadoop.executionengine.mapReduceLayer;
import java.io.IOException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -164,6 +165,39 @@ public class PigOutputCommitter extends
}
}
+
+ // This method only be called in 20.203+
+ public void commitJob(JobContext context) throws IOException {
+ // call commitJob on all map and reduce committers
+ for (Pair<OutputCommitter, POStore> mapCommitter : mapOutputCommitters) {
+ JobContext updatedContext = setUpContext(context,
+ mapCommitter.second);
+
+ try {
+ // Use reflection, 20.2 does not have such method
+ Method m = mapCommitter.first.getClass().getMethod("commitJob", JobContext.class);
+ m.invoke(mapCommitter.first, updatedContext);
+ } catch (Exception e) {
+ // Should not happen
+ assert(false);
+ }
+
+ }
+ for (Pair<OutputCommitter, POStore> reduceCommitter :
+ reduceOutputCommitters) {
+ JobContext updatedContext = setUpContext(context,
+ reduceCommitter.second);
+ try {
+ // Use reflection, 20.2 does not have such method
+ Method m = reduceCommitter.first.getClass().getMethod("commitJob", JobContext.class);
+ m.invoke(reduceCommitter.first, updatedContext);
+ } catch (Exception e) {
+ // Should not happen
+ assert(false);
+ }
+ }
+ }
+
@Override
public void abortTask(TaskAttemptContext context) throws IOException {
Modified: pig/trunk/test/findbugsExcludeFile.xml
URL: http://svn.apache.org/viewvc/pig/trunk/test/findbugsExcludeFile.xml?rev=1183120&r1=1183119&r2=1183120&view=diff
==============================================================================
--- pig/trunk/test/findbugsExcludeFile.xml (original)
+++ pig/trunk/test/findbugsExcludeFile.xml Thu Oct 13 21:45:56 2011
@@ -437,4 +437,8 @@
<Class name = "org.apache.pig.impl.util.CastUtils" />
<Bug pattern = "NP_BOOLEAN_RETURN_NULL" />
</Match>
+ <Match>
+ <Class name = "org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputCommitter" />
+ <Bug pattern = "REC_CATCH_EXCEPTION" />
+ </Match>
</FindBugsFilter>