fixed issue related to initialization of JobConf instance before calling in the configure
> used ReflectionUtils to create instance of mapper class
> and the reducer class.
git-svn-id: https://hyracks.googlecode.com/svn/trunk/hyracks@188 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopMapperOperatorDescriptor.java b/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopMapperOperatorDescriptor.java
index 7efceef..a216ac9 100644
--- a/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopMapperOperatorDescriptor.java
+++ b/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopMapperOperatorDescriptor.java
@@ -76,11 +76,11 @@
} catch (Exception e) {
throw new HyracksDataException(e);
}
+ conf = new JobConf(jobConf);
+ conf.setClassLoader(jobConf.getClassLoader());
if (!jobConf.getUseNewMapper()) {
((org.apache.hadoop.mapred.Mapper) mapper).configure(conf);
}
- conf = new JobConf(jobConf);
- conf.setClassLoader(jobConf.getClassLoader());
reporter = createReporter();
}
@@ -315,7 +315,7 @@
private Object createMapper() throws Exception {
Object mapper;
if (mapperClass != null) {
- return mapperClass.newInstance();
+ return ReflectionUtils.newInstance(mapperClass, jobConf);
} else {
String mapperClassName = null;
if (jobConf.getUseNewMapper()) {
diff --git a/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReducerOperatorDescriptor.java b/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReducerOperatorDescriptor.java
index f208669..b27cb40 100644
--- a/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReducerOperatorDescriptor.java
+++ b/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReducerOperatorDescriptor.java
@@ -33,6 +33,7 @@
import org.apache.hadoop.mapreduce.StatusReporter;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.util.Progress;
+import org.apache.hadoop.util.ReflectionUtils;
import edu.uci.ics.hyracks.api.context.IHyracksContext;
import edu.uci.ics.hyracks.api.dataflow.IDataReader;
@@ -318,7 +319,7 @@
private Object createReducer() throws Exception {
if (reducerClass != null) {
- return reducerClass.newInstance();
+ return ReflectionUtils.newInstance(reducerClass, jobConf);
} else {
Object reducer;
if(jobConf.getUseNewReducer()){