[ 
https://issues.apache.org/jira/browse/AVRO-617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Doug Cutting updated AVRO-617:
------------------------------

           Status: Patch Available  (was: Open)
         Assignee: Doug Cutting
    Fix Version/s: 1.4.0

> Catch mismatched default values
> -------------------------------
>
>                 Key: AVRO-617
>                 URL: https://issues.apache.org/jira/browse/AVRO-617
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.3
>            Reporter: John Kristian
>            Assignee: Doug Cutting
>             Fix For: 1.4.0
>
>         Attachments: AVRO-617.patch
>
>
> Please signal an error when a field's default value isn't permitted; that is 
> when it doesn't match the field type.  In particular, when the type is a 
> union, please signal an error if the default isn't a permitted value of the 
> first schema in the union.
> For example, these field declarations are erroneous:
> {"name":"f1", "type":["null", "int"], "default": 3}
> {"name":"f2", "type":["int", "null"], "default": null}
> In the current Java implementation, schema resolution using these schemata 
> will result in f1=null (not 3) and f2=0 (not null). This quiet choice of an 
> unintended value is apt to cause trouble that's difficult to diagnose.
> I propose that schema parsing signal an error when attempting to parse such 
> an erroneous schema.  Another option is for schema resolution to signal an 
> error when the reader's schema is erroneous.  Schema parsing is better, I 
> think, since it will help catch mistakes earlier, when they're cheaper to 
> correct.  It wouldn't hurt for both schema parsing and resolution to check.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to