Bo, Il giorno lun 26 set 2022 alle ore 15:39 丛搏 <bog...@apache.org> ha scritto: > > Hello, Pulsar community: > > Now, we use Avro Schema with Logical type, and the client > automatically adds logical type conversion. You can see PR > https://github.com/apache/pulsar/pull/6704. > > But AUTO_CONSUME Schema with Avro doesn't add the logical type > conversion. It makes the Time type decode to Long. > We have two ways to solve the problem: > 1. Added configuration control whether to add. This doesn't bring > compatibility issues. > 2. Do not add configuration to control, add directly like Avro Schema. > It will bring compatibility issues > > I prefer option 2 because it is a bug in itself. We don't need to > consider compatibility. Otherwise, schema loses its meaning.
There is already a NATIVE_AVRO schema, you can use a native Avro schema. The problem is that it doesn't do the AUTO_CONSUME() magic that downloads the schema. We could add some configuration to AUTO_CONSUME() like AUTO_CONSUME(Consumer<Object> nativeSchemaCustomizer) that is still in the direction that we took in 2.8 to encourage users to access native objects instead of using the pulsar GenericRecord API, that is too high level and cannot cover specific features of AVRO, Jackson, Protobuf... By the way, even if we let people customize the Schema instance in their programs, we still have the problem with Pulsar Functions and with Pulsar Sinks. If you encode with your custom Schema, you must consume the data with the same customisations. I don't have a solution for the problem at the moment Enrico > > What do you think, leave your opinion :) > > Thanks > Bo,