how do I write a java.util.map to avro ? In GenericData I see entries for Record etc, but not for Map. Same question is there on http://apache-avro.679487.n3.nabble.com/How-to-write-an-AVRO-map-Something-like-GenericData-Map-td3407527.html , but I dont understand exactly how it was done.
Avro uses java.util.HashMap
directly. You do not need to convert it to another type. Specifically, there is no GenericData
class representing a map, so you simply put your HashMap
directly into a GenericRecord
.
All of the Avro to Java conversions are listed in the table in this answer. Note that GenericData
classes are required for record
, enum
, array
, and fixed
types, but not for map
.