It seems to work when I do the reverse (add @aliases(["v2.Result"]) to the v1 schema), but that's not useful when dealing with versioning.
Francois. -----Original Message----- From: Francois Forster [mailto:[email protected]] Sent: Wednesday, December 07, 2011 4:34 PM To: [email protected] Subject: RE: AvroTypeException thrown with version change on optional record Interesting. I tried it but get: Exception in thread "main" org.apache.avro.AvroTypeException: Found { "type" : "record", "name" : "Review", "namespace" : "v2", "fields" : [ { "name" : "id", "type" : "string" }, { "name" : "text", "type" : "string" }, { "name" : "isRecommended", "type" : "boolean" } ], "aliases" : [ "v1.Review" ] }, expecting [ "null", { "type" : "record", "name" : "Review", "namespace" : "v1", "fields" : [ { "name" : "id", "type" : "string" }, { "name" : "text", "type" : "string" }, { "name" : "isRecommended", "type" : "boolean" } ] } ] -----Original Message----- From: Doug Cutting [mailto:[email protected]] Sent: Wednesday, December 07, 2011 4:15 PM To: [email protected] Subject: Re: AvroTypeException thrown with version change on optional record On 12/07/2011 01:41 PM, Francois Forster wrote: > Actually, it happens even if I don't add isFeatured. Is there something > incompatible due to the different namespace? Changing the namespace is probably why this is failing. If you need to change the namespace then you can use aliases: @namespace("v2") protocol Service { @aliases(["v1.Result"]) record Result { ... } ... } This will make v2 be able to read v1. Doug
