SaraMahdy opened a new issue, #21230: URL: https://github.com/apache/pulsar/issues/21230
### Search before asking - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar. ### Version Pulsar latest version: 3.1.0 ### Minimal reproduce step The problem happens when using Avro schema, specifically for optional records that contain logical type. Example: ``` record ExampleDecimal { union{null, RecordWithDecimal} optional_record_with_decimal = null; } record RecordWithDecimal { decimal(17,4) amount; } ``` ### What did you expect to see? Sending Avro messages in Pulsar should work with any Pulsar client either shaded or unshaded. ### What did you see instead? When using Pulsar-client with an Avro schema that contains an optional record with a logical type, an error occurs when Pulsar producer calls `AvroWtiter.write()` to serialise the message. This happens because Pulsar-client uses shade dependencies including Apache Avro shade dependency. That causes the problems because Avro calls `instance of IndexedRecord` to resolve the type of the union. Now that IndexedRecord is shaded in Pulsar so that call never returns true because the record is an instance of the normal IndexedRecord not the shaded one. That leads to a failure in serialising the record because Avro can't resolve its type. Another problem is the error message I was getting is very misleading: "No recommended schema for decimal (scale is required)". Only after thorough debugging, I could understand what's going wrong. ### Anything else? A workaround is to use Pulsar-client-original instead which doesn't use shade dependencies, but this issue is raised because Avro serialisation is now broken in the main/default Puslar client. Also, documentation doesn't mention anything about the original client, I had to look at Pulsar code to find it. ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
