[ https://issues.apache.org/jira/browse/KAFKA-7052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16939744#comment-16939744 ]
Gunnar Morling commented on KAFKA-7052: --------------------------------------- Looking into this, and it's an interesting case. The problem arises when the SMT gets one of the [schema change events|https://debezium.io/documentation/reference/0.9/connectors/mysql.html#schema-change-topic] from the Debezium MySQL connector which don't have the primary key structure as for instance your customers table. So I think actually it's not your intention to apply the SMT to these messages to begin with. Question is how to deal with this case; I could see these options when encountering a message which doesn't have the given field: * raise a more meaningful exception than NPE (pretty disruptive) * return null * leave the key/value unchanged I think for your use case, the last option is the most useful one. But returning null might also make sense in others. This might require an option perhaps? > ExtractField SMT throws NPE - needs clearer error message > --------------------------------------------------------- > > Key: KAFKA-7052 > URL: https://issues.apache.org/jira/browse/KAFKA-7052 > Project: Kafka > Issue Type: Improvement > Components: KafkaConnect > Reporter: Robin Moffatt > Priority: Major > > With the following Single Message Transform: > {code:java} > "transforms.ExtractId.type":"org.apache.kafka.connect.transforms.ExtractField$Key", > "transforms.ExtractId.field":"id"{code} > Kafka Connect errors with : > {code:java} > java.lang.NullPointerException > at > org.apache.kafka.connect.transforms.ExtractField.apply(ExtractField.java:61) > at > org.apache.kafka.connect.runtime.TransformationChain.apply(TransformationChain.java:38){code} > There should be a better error message here, identifying the reason for the > NPE. > Version: Confluent Platform 4.1.1 -- This message was sent by Atlassian Jira (v8.3.4#803005)