You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-user@hadoop.apache.org by Markus Jelsma <ma...@openindex.io> on 2011/11/30 16:44:49 UTC

Renaming WritableComparable and existing SequenceFiles

Hi,

I've built some SequenceFiles using a custom WritableComparable. I also 
decided to reorganize package structure and ended up renaming the whole thing. 
Since the key and value classes are embedded in the file i cannot read them 
because it either doesn't exist or cannot be cast in case the same classname 
lives in another package name.

I looked in the Job and SequenceFile and InputFormat API's but i cannot find 
something to tell the reader that the class is somewhere else now. Renaming 
using a hexeditor doesn't work as well because the package name's length is 
different now, leading to a lot of bad exceptions such as Unknown codec 
complaints.

I can still load the file by keeping the original WritableComparable and write 
back to disk using the new WritableComparable but that forces me to write some 
temporary code.

How can i tell the reader to use the new (but identical) class for 
WritableComparable when loading a SequenceFile? Or do i have to write some 
conversion code?

Thanks

Re: Renaming WritableComparable and existing SequenceFiles

Posted by Markus Jelsma <ma...@openindex.io>.
Solved!

Another tool reading the same files expects various childs of 
WritableComparable and Writable, this of course won't throw a class cast 
exception. That same tool writes the using the new class. In essence, i 
already had a converter tool.

Thanks

On Wednesday 30 November 2011 16:44:49 Markus Jelsma wrote:
> Hi,
> 
> I've built some SequenceFiles using a custom WritableComparable. I also
> decided to reorganize package structure and ended up renaming the whole
> thing. Since the key and value classes are embedded in the file i cannot
> read them because it either doesn't exist or cannot be cast in case the
> same classname lives in another package name.
> 
> I looked in the Job and SequenceFile and InputFormat API's but i cannot
> find something to tell the reader that the class is somewhere else now.
> Renaming using a hexeditor doesn't work as well because the package name's
> length is different now, leading to a lot of bad exceptions such as
> Unknown codec complaints.
> 
> I can still load the file by keeping the original WritableComparable and
> write back to disk using the new WritableComparable but that forces me to
> write some temporary code.
> 
> How can i tell the reader to use the new (but identical) class for
> WritableComparable when loading a SequenceFile? Or do i have to write some
> conversion code?
> 
> Thanks

-- 
Markus Jelsma - CTO - Openindex