[ 
https://issues.apache.org/jira/browse/AVRO-2258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744491#comment-17744491
 ] 

Christophe Le Saec commented on AVRO-2258:
------------------------------------------

Hello,
Spec for "[Parsing Canonical Form for 
Schemas|https://avro.apache.org/docs/1.11.1/specification/#parsing-canonical-form-for-schemas]";
 explains that canonical schema are used by a "{_}reader must use the schema 
used by the writer of the data in order to know how to read the data{_}"
 - [Default 
value|https://avro.apache.org/docs/1.11.1/specification/#schema-record] serve 
the reader when it uses a different schema than writer ({_}only used when 
reading instances that lack the field for schema evolution purposes{_}), so 
it's useless when reader use same schema as writer.
 - Aliases are also useless for the reader.

For pure finger print purpose, you could use (example is in Java)
{code:java}
SchemaNormalization.fingerprint64(schema.toString().getBytes(UTF_8));
{code}
 

Can we close this Jira ?

 

Regards,
Christophe.

> Resolution Canonical Form
> -------------------------
>
>                 Key: AVRO-2258
>                 URL: https://issues.apache.org/jira/browse/AVRO-2258
>             Project: Apache Avro
>          Issue Type: New Feature
>          Components: spec
>            Reporter: Tim Perkins
>            Priority: Major
>
> The spec defines the Parsing Canonical Form to identify schemas that are the 
> same from the perspective of reading data written against the schemas. Schema 
> Fingerprints can then be computed based on the Parsing Canonical Form.
> For our implementation of an Avro schema registry, we found schema 
> fingerprints based on the Parsing Canonical Form to be insufficient because 
> they exclude default and alias attributes which affect resolution between 
> different schemas.
> For the registry, we wanted new versions to created when defaults or alias 
> are changed.
> We extended to the Parsing Canonical Form to define a Resolution Canonical 
> Form by modifying the order transformation and adding a transformation on 
> aliases:
>  * [ORDER] Order the appearance of fields in JSON objects as follows: {{name, 
> type, fields, symbols, items, values, size, default, aliases}}
>  * [ALIASES] Aliases for named types and fields are converted to their 
> fullname, using applicable namespace, and sorted.
> We have an implementation for this that we have been using in Ruby:
> [https://github.com/salsify/avro-resolution_canonical_form]
>  
> I'm opening this issue to gauge if there is interest and support for adding 
> this to the Avro specification. If there is then I can open a pull request to 
> modify the spec.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to