I have an array of strings object called ItemSet defined like so:

   public class ItemSet extends ArrayWritable implements
WritableComparable<ItemSet>

I am able to use ItemSet as both a key and value in Hadoop jobs that I have
written. However, when I try to use "hadoop fs -text" to dump a sequence
file containing ItemSet keys and values, I get a ClassCastException. I am
specifying the jar that contains ItemSet as a "-libjars" argument, so the
class can be seen.

When I stepped into the FsShell code in the debugger I saw that the problem
occurs in org.apache.hadoop.fs.TextRecordInputStream constructor. When this
constructor tries to create the key class, it calls
ItemSet.asSubclass(WritableComparable.class). This call throws the
ClassCastException.

   1. Shouldn't it be possible to cast ItemSet to WritableComparable?
   2. Why don't I see this exception when I run code other than FsShell that
   uses ItemSet as a key?
   3. Is this the same issue as
HADOOP-4466<https://issues.apache.org/jira/browse/HADOOP-4466>
   ?

This is Hadoop 0.20.203.0.

Reply via email to