Running the following SQL script writes incorrect data to Kafka:
Printing the content of the tmp-1 topics results in the following output:
As you can see, the map is not correctly encoded as JSON and written to Kafka.
I've run the query with the Blink planner with object reuse and operator pipelining disabled.
Writing with Avro works as expected.
Hence I assume that the JSON encoder/serializer reuses the Map object when encoding the JSON.