You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Joseph Pachod <jo...@resurgences.com> on 2015/11/17 16:45:32 UTC

Different behavior between SchemaValidator and SchemaCompatibility regarding aliased field

Hello

As visible there https://gist.github.com/cluelessjoe/a618509b61be73f0bfed,
I've a first schema with just one field and then a second schema with one
field named differently but aliased to the previous schema field name.

I manage to write with the first schema and read back with the second.

However, SchemaCompatibility and SchemaValidator yields different results :
the first works while the second throws an
org.apache.avro.SchemaValidationException.

The code is :
SchemaCompatibility.checkReaderWriterCompatibility(oneFieldSchemaWithRenamedFieldAndAlias,oneFieldSchema);
new
SchemaValidatorBuilder().canBeReadStrategy().validateAll().validate(oneFieldSchema,
Arrays.asList(oneFieldSchemaWithRenamedFieldAndAlias));// throws

To me it looks like SchemaValidator has a bug, yet I don't get why there's
both SchemaValidator  and SchemaCompatibility so it feels like I'm missing
something.

Thanks in advance

Cheers
-- 
*Joseph PACHOD*