Hi Curt,

In my mind, the advantage of Writable is that when I read the code and find
a class implementing Writable, i will know it must be used as RPC(mapred
context) parameter. Another advantage is that you can control what kinds of
attributes you want to output, and what other kinds of attributes you don't
want ot output. For example, you have a class named "Person", and it looks
like:

class Person {
 private String name;
 private Date birthday;
 private int age;
 //...
}

Actually when you output the person instance, you only need to output the
name, and birthday, because the age could be calculated by birthday and
"now" (it is just a sample, but in the real world, you really have to do
something like this.). but if you use java's serializable, the "age"
attrbute must be transient. if you forget to make it transient, you may get
trouble. Even more, you want to output the "name" attribute as some other
encoded string, such as GBK encoding (%XX%XX),   for another application
written by C++. how can you do it?

by using distinguished Writable interface, you can control everything.

Best wishes,
Feng

On 9/25/06, Curt Cox <[EMAIL PROTECTED]> wrote:

"but when you develop a big project, you will find you need another
way to help you identity which type is serializable in MR context just
by a glance."

Please explain what you mean by "serializable in MR context".  How is
the fact that lots of stuff already serializable a reason to favor
Writable?

- Curt

Reply via email to