yurybubnov opened a new pull request, #1970:
URL: https://github.com/apache/avro/pull/1970

   ## What is the purpose of the change
   According to [Avro 
documentation](https://avro.apache.org/docs/1.11.1/specification/#enums) for 
default value for Enums:
   ```
   default: A default value for this enumeration, used during resolution when 
the reader encounters a symbol from the writer that isn’t defined in the 
reader’s schema (optional). The value provided here must be a JSON string 
that’s a member of the symbols array. See the documentation on schema 
resolution for how this gets used.
   ```
   And in [Schema 
Resolution](https://avro.apache.org/docs/1.11.1/specification/#schema-resolution)
   ```
   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.
   ```
   
   This is not the case at the moment in Java implementation.
   In the 
[TestSchemaCompatibilityEnumDefaults](https://github.com/apache/avro/blob/master/lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibilityEnumDefaults.java),
 both writer and reader schemas are required for successful decoding object 
serialized with new schema into old schema. 
   It should be possible, to decode Enums with just the old schema, without the 
new one present, as in specified in the documentation.
   
   
   ## Verifying this change
   
   
   This change added tests and can be verified as follows:
   * New test is added to TestSchemaCompatibilityEnumDefaults to verify the 
change
   
   
   ## Documentation
   
   - Does this pull request introduces a new feature? No
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to