jerrypeng commented on issue #3741: POJO AvroSchema always allowNull URL: https://github.com/apache/pulsar/issues/3741#issuecomment-469440286 @skyrocknroll @sijie I don't think the current API is the problem, I think we just need to separate API to specify a custom schema. We currently only allow users to derive a schema from a Java class using the Avro library. This generates an Avro schema that matches the semantics of java i.e. classes can be null and primitives are not. However, if I have my own custom avro schema, I can arbitrarily set one class to be nullable while the another class is not. There is not way for Avro to know that information from just a java class definition. Even by allowing users to set the flag "allowNull" will not cover all cases as user can arbitrarily create avro schemas will null or not null fields. I think we can do the following: 1. Use Avro java annotation to massage your java class to have the schema you desire 2. Have an API for users to specify the schema they want.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
