[ 
https://issues.apache.org/jira/browse/AVRO-1965?focusedWorklogId=735897&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-735897
 ]

ASF GitHub Bot logged work on AVRO-1965:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Mar/22 12:06
            Start Date: 03/Mar/22 12:06
    Worklog Time Spent: 10m 
      Work Description: martin-g opened a new pull request #1576:
URL: https://github.com/apache/avro/pull/1576


   The bug was fixed with AVRO-1646.
   This PR just adds the test case from the patch attached to AVRO-1945
   
   ### Jira
   
   - [X] My PR addresses the following [Avro 
Jira](https://issues.apache.org/jira/browse/AVRO/) issues and references them 
in the PR title. For example, "AVRO-1234: My Avro PR"
     - https://issues.apache.org/jira/browse/AVRO-1965
   
   ### Tests
   
   - [X] My PR adds  a new unit test
   
   ### Commits
   
   - [X] My commits all reference Jira issues in their subject lines. In 
addition, my commits follow the guidelines from "[How to write a good git 
commit message](https://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [X] No need of documentation


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

            Worklog Id:     (was: 735897)
    Remaining Estimate: 0h
            Time Spent: 10m

> Reparsing an existing schema mutates the schema
> -----------------------------------------------
>
>                 Key: AVRO-1965
>                 URL: https://issues.apache.org/jira/browse/AVRO-1965
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.1
>            Reporter: Dave Maughan
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>             Fix For: 1.11.0
>
>         Attachments: AVRO-1965.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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","type":{"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","type":{"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
(v8.20.1#820001)

Reply via email to