I have create a class VectorWritable which implements the interface Writable. I am trying to write a VectorWritable object to the output file but i am getting this: VectorWritable@1355b88b. Here is my write method:
public void write(DataOutput out) throws IOException {
getVectorString().write(out);
}
The function getVectorString() gives a Text object.
I don't have 50 rep to comment, so I will write it as an answer.
How do you create this Text object inside getVectorString()? Aren't you invoking default toString() method on the VectorWritable object, which returns strings like "VectorWritable@1355b88b" unless you override it to return a more useful string which describes your object?
EDIT:
According to your comment
Text vectorString
is a member ofVectorWritable
class, you set thisText
object inset
method so i guess that theset
method is also insideVectorWritable
, and it is not a static method, so why do you pass aVectorWritable
object to it? It looks like you could invoke thisset
method on oneVectorWritable
object, pass another to it, and havevectorString
not matching surroundingVectorWritable
object.How do you write
VectorWritable
to the output? Do you invoke thewrite
method which you posted inside your question? Because this outputVectorWritable@1355b88b
looks like you passVectorWritable
as an argument to a method which invokes its defaulttoString()
method which would return string likeVectorWritable@1355b88b
.Writable interface is used to serialize objects. So you can write the object to an output, and read it back, but with your implementation it would be hard to parse the string you create and read the object back. Example of implementation