You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by KV 59 <kv...@gmail.com> on 2020/07/07 18:57:32 UTC

Schema Evolution Removing fields

>
> Hi,

I'm trying to remove a field which is required in the old schema (which is
by default)

long field1;


and want to remove the field in the updated schema I made it optional and
nullable

union {null, long} field1 = null;


Now the new schema can read the objects from the old schema (Backward
compatible) but not the other way round (Forward compatible).

What is the best strategy to have both?

Thanks
Kishore

Re: Schema Evolution Removing fields

Posted by "Driesprong, Fokko" <fo...@driesprong.frl>.
Hi Kishore,

This isn't possible. The fields should be optional in the first place. I
always use the table from Confluence:
https://docs.confluent.io/current/schema-registry/avro.html

The way to do this is to only add, or delete optional fields.

Hope this helps.

Kind regards, Fokko

Op di 7 jul. 2020 om 20:57 schreef KV 59 <kv...@gmail.com>:

> Hi,
>
> I'm trying to remove a field which is required in the old schema (which is
> by default)
>
> long field1;
>
>
> and want to remove the field in the updated schema I made it optional and
> nullable
>
> union {null, long} field1 = null;
>
>
> Now the new schema can read the objects from the old schema (Backward
> compatible) but not the other way round (Forward compatible).
>
> What is the best strategy to have both?
>
> Thanks
> Kishore
>
>