Hi,

You will need to write a new org.apache.avro.io.Encoder.
If you succeed making it then please share it with the commuity via Pull
Request!
If you don't - please create an issue and we will try to help!

On Sun, Dec 5, 2021 at 6:31 PM KV 59 <kvajjal...@gmail.com> wrote:

> Hi All,
>
> Here is my situation, I have a SpecificRecord for a Schema S and I want to
> convert it into a GenericRecord of a compatible Schema T (It is an older
> version of S). I have seen many such examples but all strategies point to
> serializing the SpecificRecord to either bytes or JSON and deserializing
> back to the GenericRecord. This seems to be inefficient especially if the
> records are huge and in a high volume streaming scenario like mine.
>
> I cannot simply cast the SpecificRecord to GenericRecord because of some
> type incompatibilities like Enums and Instants.
>
> I have been looking at the SpecificRecordDatumWriter/Reader sources and
> try to build a Mapper which just sets the value in the GenericRecord but I
> cannot write such a mapper without the help of any of the protected and
> private methods in them.
>
> There is a same problem of converting a POJO to GenericRecord as well
>
>
> Appreciate your inputs and recommendations
>
> Thanks
> Kishore
>
>
>
>
>

Reply via email to