avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clément MATHIEU <clem...@unportant.info>
Subject How to clone and modify a Schema
Date Tue, 26 May 2015 13:12:18 GMT
Hello all,

I am wondering what is the easiest way to clone a Schema, then filter 
out, or add a property, to some of its fields ?

Basically, I am implementing something similar to avro-sorting, 
https://github.com/alexholmes/avro-sorting
, but want to hack the Schema on the fly rather than having to rely on 
something like AvroDataHack.

----
     class MyBean {

       private String foo;
       private String bar;

       [...]
     }

     Schema schema = ReflectData.get().getSchema(MyBean.class);
     // Here I want to clone schema then filter out bar (add order:ignore 
to it)
----

I am mainly interested in supporting top level fields of a record, but 
not against a more comprehensive solution.


Thanks,

Clément

Mime
View raw message