On 09/13/2010 03:53 PM, Lin Guo wrote:
I am wondering why Avro has a special type NULL instead of allowing
each type has null value? What benefit can we gain from this design?

When serialized, if any value may be null then it must be noted that it is non-null, adding at least a bit to the size of every value stored and corresponding computational costs to create this bit on write and interpret it on read. These costs are wasted when values may not in fact be null, as is the case in many datasets. In Avro such costs are only paid when values may actually be null.

Also, allowing values to be null is a well-known source of errors. In Avro, a value declared as non-null will always be non-null and programs need not test for null values when processing it nor will they ever fail for lack of such tests.

Tony Hoare calls his invention of null references his "Billion Dollar Mistake".

http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake

Doug

Reply via email to