Hi,
I have Hadoop 1.0.3 running on Ubuntu Linux. I am playing around with a simple
Map-Reduce job.
Details of the code
=============
1. Since this exercise is mainly to learn basic Hadoop APIs and learn how to
run these jobs, the logic in the Map job is irrelevant.
2. The code snippet is below with just the APIs (which I believe is causing a
problem - PLEASE correct me if I am wrong and I will post the entire code
snippet)public
....
....public
Reporter reporter)
...
...
}publicvoidmap(String sourceKey, String sourceValue, OutputCollector<String,
String> outputC,throwsIOException {
}
Exception:
hduser@utester-VirtualBox:/usr/local/hadoop/bin$ /usr/local/hadoop/bin/hadoop
jar
~/HadoopCodeProjectsFolder/JobOrganizerMapRedProject/11182012/HadoopMapRedProject.jar
org.u.hadoopmapred.JobOrganizer
Warning: $HADOOP_HOME is deprecated.
12/11/18 16:36:22 WARN mapred.JobClient: Use GenericOptionsParser for parsing
the arguments. Applications should implement Tool for the same.
12/11/18 16:36:22 INFO util.NativeCodeLoader: Loaded the native-hadoop library
12/11/18 16:36:22 WARN snappy.LoadSnappy: Snappy native library not loaded
12/11/18 16:36:22 INFO mapred.FileInputFormat: Total input paths to process : 1
12/11/18 16:36:22 INFO mapred.JobClient: Running job: job_201211181608_0002
12/11/18 16:36:23 INFO mapred.JobClient: map 0% reduce 0%
12/11/18 16:36:42 INFO mapred.JobClient: Task Id :
attempt_201211181608_0002_m_000000_0, Status : FAILED
java.lang.ClassCastException: org.apache.hadoop.io.LongWritable cannot be cast
to java.lang.String
at org.u.hadoopmapred.JobOrganizer$JobOrganizerMapper.map(JobOrganizer.java:1)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436)
The Mapper Interface as per the javadoc is: Interface Mapper <K1, V1, K2, V2>
and its map function is: map(K1 key, V1 value, OutputCollector<K2, V2> output,
Reporter). I wanted to parameterize K1, V1, K2, V2 to all be String. Is
something wrong in the way I am thinking? Is this what is wrong? I have found
similar questions on the internet but the asnwers did not clarify how I am
breaking the Mapper contract (I did not have any compile errors - just a
runtime error).
Thanks
@OverridestaticclassJobOrganizerMapper extendsMapReduceBase
implementsMapper<String, String, String, String> {classJobOrganizer