Accessing nested fields in AVRO GenericRecord (Java/Scala)
问题 I have a GenericRecord with nested fields. When I use genericRecord.get(1) it returns an Object that contains the nested AVRO data. I want to be able to access that object like genericRecord.get(1).get(0) , but I can't because AVRO returns an Object. Is there an easy way around this? When I do something like returnedObject.get("item") it says item not a member of returnedObject . 回答1: I figured out one way to do it. Cast the returned Object as a GenericRecord . Example (scala): val data