How to delete row from table using a producer?

I have posted the question also on Stackoverflow:

I am trying to delete a row from a ksql db source table that contains json values.

In my case I did it like this.

ksql> CREATE STREAM to_delete (id VARCHAR KEY, DUMMY VARCHAR)
> WITH (KAFKA_TOPIC='mytopic', VALUE_FORMAT='KAFKA');

ksql> INSERT INTO to_delete (id, DUMMY) VALUES ('"some_id"', CAST(NULL as VARCHAR));

But producing a message with a null value does not work. The row is not deleted.

confluent kafka topic produce mytopic --parse-key
Starting Kafka Producer. Use Ctrl-C to exit.
'"some_id"':null
'some_id':null

In the processing log of the table I can see this message

{
  "MESSAGE": "null",
  "DESERIALIZATIONERRORCAUSE": [],
  "DESERIALIZATIONERRORMESSAGE": "Cannot invoke \"org.apache.kafka.connect.data.Struct.schema()\" because \"struct\" is null",
  "RECORDPROCESSINGERRORCAUSE": null,
  "RECORDPROCESSINGERRORRECORD": null,
  "RECORDPROCESSINGERRORERRORMESSAGE": null,
  "SERIALIZATIONERRORCAUSE": null,
  "SERIALIZATIONERRORRECORD": null,
  "SERIALIZATIONERRORERRORMESSAGE": null,
  "PRODUCTIONERRORERRORMESSAGE": null,
  "KAFKASTREAMSTHREADERRORCAUSE": null,
  "KAFKASTREAMSTHREADERRORTHREADNAME": null,
  "KAFKASTREAMSTHREADERRORERRORMESSAGE": null
}

How can I produce a message to delete the row in ksqldb?

This topic was automatically closed after 30 days. New replies are no longer allowed.