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

Elliot West edited comment on AVRO-1933 at 2/21/17 3:18 PM:
------------------------------------------------------------

Thanks for your interest [~epkanol]. JSON Pointer has a 'unusual' escaping 
system. As the {{/}} character is a path separator, any JSON identifiers 
containing said character must be replaced with {{~0}}. The tilde character 
then holds a special meaning, so then any literal uses in JSON identifiers must 
then be escaped with {{~1}}. The patch I have does this. With reference to your 
question regarding unions, the index of the branch is used as the idetifier, 
which translates nicely to JSON Pointer's array index specification. The same 
applies to fields in records. Consider the following schema:

{code}
{
  "type" : "record",
  "name" : "myRecord",
  "fields" : [ {
    "name" : "myId",
    "type" : "long"
  }, {
    "name" : "myValue",
    "type" : [ "string", "long", "null" ]
  } ]
}
{code}

If say the {{string}} branch of a union was missing in the companion schema, 
the path to the root cause of the schema issue would be: {{/fields/1/type/0}}.

I'll certainly add some more test cases :-)


was (Author: teabot):
Thanks for your interest [~epkanol]. JSON Pointer has a 'unusual' escaping 
system. As the {{/}} character is a path separator, any JSON identifiers 
containing said character must be replaced with {{~0}}. The tilde character 
then holds a special meaning, so then any literal uses in JSON identifiers must 
then be escaped with {{~1}}. The patch I have does this. With reference to your 
question regarding unions, the index of the branch is used as the idetifier, 
which translates nicely to JSON Pointer's array index specification. The same 
applies to fields in records. Consider the following schema:

{code}
{
  "type" : "record",
  "name" : "mineRecord",
  "fields" : [ {
    "name" : "myId",
    "type" : "long"
  }, {
    "name" : "myValue",
    "type" : [ "string", "long", "null" ]
  } ]
}
{code}

If say the {{string}} branch of a union was missing in the companion schema, 
the path to the root cause of the schema issue would be: {{/fields/1/type/0}}.

I'll certainly add some more test cases :-)

> SchemaCompatibility class could be more user-friendly about incompatibilities
> -----------------------------------------------------------------------------
>
>                 Key: AVRO-1933
>                 URL: https://issues.apache.org/jira/browse/AVRO-1933
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.8.1
>         Environment: Any Java env
>            Reporter: Anders Sundelin
>            Priority: Minor
>             Fix For: 1.9.0
>
>         Attachments: AVRO-1933-compatible-with-AVRO-1931.patch, 
> AVRO-1933.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Today, the class SchemaCompatibility reports incompatibilities with quite 
> little detail. The whole reader and the whole writer schema is listed, and no 
> particular detail about what was incompatible.
> The attached patch fixes this, introducing a new enum 
> (SchemaIncompatibilityType), and more specific sub-schemas that were 
> incompatible.
> The old, overall picture, is still there - the new compatibility state is 
> encapsulated in the SchemaCompatibilityDetails class.
> Lots of test cases have been added, and there has been refactoring done in 
> the TestSchemaCompatibility and other test classes.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to