On 11/18/09 1:51 PM, "Doug Cutting" <[email protected]> wrote:

> I don't know that these conventions are always the best.  Consider the
> extreme: if the reader's top-level schema is "int" and the writer wrote
> using a "float" schema, should we:
> 
>   a. require that implementations signal an error;
>   b. require that implementations ignore this, e.g., returning null or
> unset or somesuch; or,
>   c. permit implementations to vary?
> 
> Currently the spec indicates (a). This applies equally to field type
> mismatches as to top-level type mismatches.  That said, there might be
> cases where an application wants to read all fields it can map into an
> existing datastructure, ignoring whatever it cannot read.
> 
> Thus we might change the spec to say that implementations are
> recommended (but not required) to signal errors in such cases.  An
> implementation that signals such errors can state in its documentation
> that it implements the recommended resolution algorithm.  An
> implementation that does not should state how it deviates.
> 

This strikes me as something that is going to be very application/user
specific.

Maybe, this is something a client can specify in the schema? For field name
"foo" that the client thinks should be "int",  "promotefrom" = "float" might
signal that its ok to cast the float to an int without error.  We could have
a set of universal defaults with configurable overrides for each type.  We
already have "default" to deal with missing items, what to do with
mismatches seems to be along similar lines.

Such a configuration could live outside the schema in some sort of client
configuration.  Although this again could map to annotations in the java
case, something that is general and applies to all languages might be
better.  Thus, the schema itself, or metadata around it / within it.

Specifically, I'm starting to think ahead to the challenges of schema
migration and versioning.  If I'm going to start using Avro (hopefully in 3
weeks!) I need to think about and solve my approach here.  Although a good
set of default behavior is mandatory, I can't help but think that I'll run
into a situation that I want to override that behavior.



> 
> Doug
> 

Reply via email to