[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avro-user
Subject:    Different behavior between SchemaValidator and SchemaCompatibility regarding aliased field
From:       Joseph Pachod <joseph.pachod () resurgences ! com>
Date:       2015-11-17 15:45:32
Message-ID: CAO5BSRzMQQsQ-gnX9u=QP9Qj2NBVjBDO-CsyYeqwQF4OA-KWog () mail ! gmail ! com
[Download RAW message or body]

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*


[Attachment #3 (text/html)]

<div dir="ltr">Hello<div><br></div><div>As visible there  <a \
href="https://gist.github.com/cluelessjoe/a618509b61be73f0bfed">https://gist.github.com/cluelessjoe/a618509b61be73f0bfed</a>, \
I&#39;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.</div><div><br></div><div>I manage to write with the first schema and read back \
with the second.</div><div><br></div><div>However, SchemaCompatibility and \
SchemaValidator yields different results : the first works while the second throws an \
org.apache.avro.SchemaValidationException.  </div><div><br></div><div>The code is \
:</div><div><div>SchemaCompatibility.checkReaderWriterCompatibility(oneFieldSchemaWithRenamedFieldAndAlias,oneFieldSchema);</div><div>new \
SchemaValidatorBuilder().canBeReadStrategy().validateAll().validate(oneFieldSchema, \
Arrays.asList(oneFieldSchemaWithRenamedFieldAndAlias));// \
throws</div><div><br></div><div>To me it looks like SchemaValidator has a bug, yet I \
don&#39;t get why there&#39;s both SchemaValidator   and SchemaCompatibility so it \
feels like I&#39;m missing something.</div><div><br></div><div>Thanks in \
advance</div><div><br></div><div>Cheers</div>-- <br><div class="gmail_signature"><div \
dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
dir="ltr"><div style="margin:0px;font-family:Arial"><b>Joseph \
PACHOD</b><br></div><div \
style="margin:0px"><br></div></div></div></div></div></div></div></div> </div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic