dosvath opened a new pull request #10375: URL: https://github.com/apache/kafka/pull/10375
**Problem** The [current Cast SMT](https://github.com/apache/kafka/blob/trunk/connect/transforms/src/main/java/org/apache/kafka/connect/transforms/Cast.java) fails on a null record value (or a null record key), which is problematic for tombstone records. When a tombstone record reaches the transformation the error below is thrown: With schema: ``` Cannot list fields on non-struct type org.apache.kafka.connect.errors.DataException: Cannot list fields on non-struct type at org.apache.kafka.connect.data.ConnectSchema.fields(ConnectSchema.java:179) at org.apache.kafka.connect.transforms.Cast.getOrBuildSchema(Cast.java:190) ``` For schemaless: ``` Caused by: org.apache.kafka.connect.errors.DataException: Only Map objects supported in absence of schema for [cast types], found: null at org.apache.kafka.connect.transforms.util.Requirements.requireMap(Requirements.java:38) ``` **Solution** Null value records should instead be allowed to pass through as there is no cast transformation to be done, with the benefit of allowing the connector to handle the tombstone records as intended. **Testing** Added SMT unit tests to verify the records pass through when the keys or values are null. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- 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: us...@infra.apache.org