hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KARASZI Istvan <ikara...@adverticum.com>
Subject strict class checking in MapTask collect
Date Tue, 02 Mar 2010 09:01:38 GMT
dear members!

I'm new to the list so sorry if this was asked before. I've tried to search the archives but
I could not find any thread like this before.

My problem is that I have a class which contains which implements the WritableComparable interface
for the input key of the mapreduce algorithm let's assume that this class is A. I have a different
abstract class which extends this class with two methods (needed for line parsing) let's call
this B, and two other classes which extends this abstract class C and D.

I set this original class (A) as the output key for the Mapper, but if I set the output object
with the Context.write() method it throws an exception from MapTask.java with the following
message: Type mismatch in key from map...


My question is why do you need exact class matches in MapTask.java in collect() method, why
isn't it better to write this at the line 806:

if (keyClass.isAssignableFrom(key.getClass())) {

instead of this:

if (key.getClass() != keyClass) {

thanks,
-- 
KARASZI Istvan


Mime
View raw message