Santanu C
Santanu C

Reputation: 1392

Does value type in hadoop type has to implement writable interface?

I am trying to understand how to implement custom value type for mapreduce framework. Based on this post (MapReduce - WritableComparables) it seems to me that the value type has to implement Writable interface. Is that correct?

I was also following the source code various tools (e.g. Import, Export, CopyTable etc.) provided by HBase. Import uses Result as Value type. But Result does not implement Writable interface. How does the serialization step work in this situation?

Upvotes: 0

Views: 269

Answers (1)

yjshen
yjshen

Reputation: 6693

There are Writable and WritableComparable in MapReduce.

  • Writable means MR know how to searialize your object when it have to be sent through wire.
  • WritableComparable goes one step further, means objects of the class that implement it could be sort.

In MR's implementation, keys would be compared and/or sort during the shuffle procedure, which means it should be WritableComparable. values only need to be sent across wire, so Writable is enough.

Upvotes: 1

Related Questions