Hi, I wonder if I'm running into a bug with builders for specific records here. I'm using the Builder of a specific record to create a new instance of that record with the same properties. See the following schema's:
{"namespace": "test.model", "type": "record", "name": "Address", "fields": [ {"name": "street", "type": "string"}, {"name": "number", "type": [ "int", "null" ]}, {"name": "city", "type" : [ "string", "null" ]}, {"name": "country", "type": { "name" : "Country", "type" : "enum", "symbols": [ "NL", "BE", "UK", "DE" ]}} ] } and {"namespace": "test.model", "type": "record", "name": "User", "fields": [ {"name": "identifier", "type": "string"}, {"name": "name", "type": "string"}, {"name": "number", "type": ["int", "null"]}, {"name": "color", "type": ["string", "null"]}, {"name": "address", "type": ["test.model.Address", "null"] }, {"name": "properties", "type": [ {"type": "map", "values": "string"} , "null"], "values": "string" } ] } I generated Java objects for these and I'm creating new objects using the following code: Address address = new Address("street", 10, "city", Country.NL); User user = new User("1", "Xander", 10, "green", address, new HashMap<String, String>()); So I'm creating a user which has a reference to an Address. When I try to create a 'copy' of this object using the builder: User copy = User.newBuilder(user).build(); This results in a ClassCastException: java.lang.ClassCastException: org.apache.avro.generic.GenericData$Record cannot be cast to graph.test.model.Address at test.model.User$Builder.<init>(User.java:240) at test.model.User$Builder.<init>(User.java:221) at test.model.User.newBuilder(User.java:170) Am I not using the builder the way it's meant to be used, or did I run into a bug here ? I'm using avro 1.7.7 btw. Thanks, Xander