eolivelli commented on pull request #9895: URL: https://github.com/apache/pulsar/pull/9895#issuecomment-800877440
@sijie I strongly believe that Object is the best choice for the long term: 1) Consumer<Object> and Sink<Object> is simpler for Java users 2) If we go down the wrapper way we should find another name, 'Record' is a type of data structure, IMHO a String does not fit the word "Record", the same for Array...(Avro itself does not wrap primitive types with GenericContainer, we can follow their model) 3) PrimitiveRecord wrapper won't match current behaviour of GenericRecord regarding nested structs (see below) for 3): When you call "getField" on that GenericRecord for a String field now you receive a java.lang.String for a String and a GenericRecord for a Struct. In this new model for a String field you should still return a PrimitiveRecord that wraps the String in order to be consistent, but it will be an important and unexpected behaviour change. So all in all I believe that we should stick to Object type and not to a wrapper. On Pulsar IO you already have the schema (Record#getSchema) and in the client API you can still lookup the schema using the Schema Version. ---------------------------------------------------------------- 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]
