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

Jonathan Rapoport edited comment on AVRO-2918 at 8/16/20, 4:24 AM:
-------------------------------------------------------------------

Sure [~emkornfield]:
 Picture this base schema:
{code:json}
{
 "type" : "record",
 "namespace" : "avro.polymorphism",
 "name" : "Person",
 "fields" : [
    { "name" : "Name" , "type" : "string" },
    { "name" : "Age" , "type" : "int" }
  ]
 }
{code}

 And this inherited schema:

{code:json}
{ 
  "type" : "Person", 
  "namespace" : "avro.polymorphism", 
  "name" : "Employee", 
  "fields" : 
    [ 
      # already included { "name" : "Name" , "type" : "string" },
      # already included { "name" : "Age" , "type" : "int" },
      { "name" : "Position" , "type" : "string" },
      { "name" : "Salary" , "type" : "int" }
    ]
 }
 {code}


was (Author: jonirap):
Sure [~emkornfield]:
 Picture this base schema:
```json

{
 "type" : "record",
 "namespace" : "avro.polymorphism",
 "name" : "Person",
 "fields" : [

{ "name" : "Name" , "type" : "string" }

,

{ "name" : "Age" , "type" : "int" }

]
 }

```
 And this inherited schema:

```json
{
 "type" : "Person",
 "namespace" : "avro.polymorphism",
 "name" : "Employee",
 "fields" : [
 \# already included \{ "name" : "Name" , "type" : "string" },

 \# already included \{ "name" : "Age" , "type" : "int" },

 { "name" : "Position" , "type" : "string" },
{ "name" : "Salary" , "type" : "int" }
]
 }
```

> Schema polymorphism
> -------------------
>
>                 Key: AVRO-2918
>                 URL: https://issues.apache.org/jira/browse/AVRO-2918
>             Project: Apache Avro
>          Issue Type: New Feature
>          Components: logical types, misc, spec
>            Reporter: Jonathan Rapoport
>            Priority: Major
>              Labels: features
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> Include the option to use named types as base types for a new schema. Allow 
> for MRO generation. Field inheritance. 
> The benefits of this approach include:
>  * Defining a schema as validation for a certain wire, and so allowing the 
> receiver to be certain of the structure of the data (this works today). 
> However, defining an extension of this schema, or certain schemas which can 
> be normalized to the original schema, but contain additional information, 
> will not allow it to be sent over the same wire.
>  * Backwards compatibility through inheritance - you never break the old 
> schema, thus allowing a long integration period, with no need to recode all 
> processes familiar with the schema. The new schema will simply inherit the 
> old one, and only add information.
>  * Allow for full data control through polymorphism, and the ability to 
> replace structures within any supported language. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to