I believe you can just add an alias in the second schema such RecordB is also 
known as RecordA and the second schema will then work as a reader's schema for  
records written in the former (RecordA) schema.

Of course your parser must be provided with *both* schemas the one for RecordA 
as the writer's schema and the one for RecordB as the reader's schema.

On Jun 27, 2014, at 5:53 PM, "Arvind Kalyan" 
<[email protected]<mailto:[email protected]>> wrote:

Hey folks,

How do we handle cases where the reader and writer record schemas have 
different record names but their fields are in a is-a relationship with slight 
differences in their fields.

For example:

{
    "type": "record",
    "name": "RecordA",
    "fields": [
        {"name": "a", "type": "string"},
        {"name": "b", "type": ["null", "long"]},
        {"name": "c", "type": {"type": "array", "items": "string"}}
    ]
}

{
    "type": "record",
    "name": "RecordB",
    "fields": [
        {"name": "a", "type": "string"}
    ]
}

In the above case, what's the best way to use RecordB for reading what was 
written using RecordA?

--
Arvind Kalyan
http://www.linkedin.com/in/base16
cell: (408) 761-2030

Reply via email to