avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Kenworthy <adwkenwor...@yahoo.com>
Subject Does Avro GenericData.Record violate the .equals contract?
Date Thu, 09 Feb 2012 15:02:19 GMT

I'm working with avro as the serialization framework for my hadoop map-reduce jobs, and am
emitting GenericRecord/null as my K/V values from my mapper classes. Having looked at the
code, I see that the "key" objects (i.e. my records) are only recognised as being discrete
by my reducer if it sees that the .equals() method called on the record shows a distinction.
However, if the schema is the same (which it is for most of my mappers), then .equals() calls
.compare(), which in turn depends on the ORDER attributes set on the fields. This means that
if I have no sorting defined in my schema, that all records are treated as being equal to
one another. Have I understood this correctly, and if so, is that not a violation of the equals
contract? (for one thing, it would mean GenericRecord objects will often cause confusion when
used with maps and other containers).


View raw message