It works both ways in compatibility Validation. I have used the Avro
library for compatibility check
SchemaValidator validator = builder.mutualReadStrategy().validateAll();


The SchemaValidator says it is valid with the first schema as reader and
second schema as writer and vice versa is valid as well.

Obviously this is not the case. since symbol "S7" is not present in schema1
and also it has no default value defined,



On Fri, May 5, 2023 at 7:37 AM Brennan Vincent <[email protected]>
wrote:

> Which one is the writer and which is the reader?
>
> Sent from my iPhone
>
> On May 4, 2023, at 22:47, KV 59 <[email protected]> wrote:
>
> 
> Hi,
>
> I see that that java Avro compatibility check doesn't work as per
> specification for enum schema evolution. I have a the following schema
>
> {
>>   "type" : "record",
>>   "name" : "TestEnumRec",
>>   "namespace" : "com.five9.avro.enum.test",
>>   "fields" : [ {
>>     "name" : "enumType",
>>     "type" : {
>>       "type" : "enum",
>>       "name" : "EnumType",
>>       "symbols" : [ "S1", "S2", "S3", "S4", "S5", "S6" ]
>>     }
>>   } ]
>> }
>
>
> And another version of the same schema
>
> {
>>   "type" : "record",
>>   "name" : "TestEnumRec",
>>   "namespace" : "com.five9.avro.enum.test",
>>   "fields" : [ {
>>     "name" : "enumType",
>>     "type" : {
>>       "type" : "enum",
>>       "name" : "EnumType",
>>       "symbols" : [ "S1", "S2", "S3", "S4", "S5", "S6", "S7" ]
>>     }
>>   } ]
>> }
>
>
>  These schemas show as compatible for mutual read
>
> This is not in line with what the specification says
>
>>
>>    -
>>
>>    if both are enums: if the writer’s symbol is not present in the
>>    reader’s enum and the reader has a default value, then that value is used,
>>    otherwise an error is signalled.
>>
>>
> I have tried this in Avro 1.9.1 and 1.11.1. Is this a bug?  If not, what
> am I doing wrong?
>
> Appreciate reponses
>
> Regards,
> Kishore
>
>

Reply via email to