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

List:       avro-dev
Subject:    [jira] [Commented] (AVRO-1965) Reparsing an existing schema mutates the schema
From:       "Nandor Kollar (JIRA)" <jira () apache ! org>
Date:       2017-06-22 13:03:00
Message-ID: JIRA.13024399.1480504983000.80438.1498136580067 () Atlassian ! JIRA
[Download RAW message or body]


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

Nandor Kollar commented on AVRO-1965:
-------------------------------------

Looks good to me too.

> Reparsing an existing schema mutates the schema
> -----------------------------------------------
> 
> Key: AVRO-1965
> URL: https://issues.apache.org/jira/browse/AVRO-1965
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.1
> Reporter: David Maughan
> Assignee: Doug Cutting
> Fix For: 1.8.3
> 
> Attachments: AVRO-1965.patch
> 
> 
> h2. Overview
> In certain scenarios re-parsing a schema constructed via {{SchemaBuilder}} or \
> {{Schema.createRecord}} produces a schema that is no longer equal to the original. \
> In the below example, after parsing the existing schema, the namespace of the top \
> level record is cascaded down to the bottom level record. Note that the way the top \
> level record is being created with the namespace as part of the name {{default.a}} \
> is the same way Hive's {{AvroSerDe}} constructs a schema from a Hive table's \
> metadata. h2. Failing test case
> {code}
> Schema d = SchemaBuilder.builder().intType();
> Schema c = SchemaBuilder.record("c").fields().name("d").type(d).noDefault().endRecord();
>  Schema b = SchemaBuilder.record("b").fields().name("c").type(c).noDefault().endRecord();
>  Schema a1 = SchemaBuilder.record("default.a").fields().name("b").type(b).noDefault().endRecord();
>  Schema a2 = new Schema.Parser().parse(a1.toString());
> // a1 = {"type":"record","name":"a","namespace":"default","fields":[{"name":"b","typ \
> e":{"type":"record","name":"b","namespace":"","fields":[{"name":"c","type":{"type":"record","name":"c","fields":[{"name":"d","type":"int"}]}}]}}]}
>  // a2 = {"type":"record","name":"a","namespace":"default","fields":[{"name":"b","ty \
> pe":{"type":"record","name":"b","namespace":"","fields":[{"name":"c","type":{"type": \
> "record","name":"c","namespace":"default","fields":[{"name":"d","type":"int"}]}}]}}]}
>  assertThat(a2, is(a1));
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


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

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