On Thu, Oct 19, 2017 at 8:49 AM, Zoltan Ivanfi <[email protected]> wrote:
> > So then if an older reader reads a schema field with "default-as-string" > > used instead of "default", it will decide that field has no default? I > > don't really like that, but it's better than using the wrong value (e.g. > > "default" + "default-parser") > > > I think ignoring the user-specified default value is just as bad using a > wrong value. I equally consider both breaking changes. > Since defaults are only used for fields not present in the written data, ignoring a default value means failing to read the data. This seems reasonable: if the user requires a feature that the runtime they're using does not yet support, then an error is signalled. > > > > I think that the parsing canonical form of a schema > > > > <https://avro.apache.org/docs/ > 1.8.2/spec.html#Parsing+Canonical+Form+for+Schemas> > > > > doesn't include the default. I think that makes sense because the > > > > canonical form is what's needed to read encoded data. > > That's strange, since according to the specification, the default is used > when reading instances that lack a value for the field, so I think it is > needed for reading encoded data. > That depends on what you mean by "reading". A record is first read using the schema it was written with. Through resolution, it can be subsequently altered to match various other schemas. Defaults only come into play when such a schema has a field not in the written schema. Parsing Canonical Form indicates whether a schema can be used for that first, raw, read. There is no single canonical form for all the various schemas that it can be resolved to. Doug
