Affected Version
The Druid version where the problem was encountered: 0.22.x, 0.23.x
Description
When setting up a request emitter to use KafkaEmitter the queryType property is not serialized to a JSON. The problem is located in the method: public void emit(final Event event) of KafkaEmitter.java.
The problem is that the rendering of the JSON string is done on the Map<String, Object>. The Jackson ignores the polymorphic annotation on the Query class with queryType if the query is serialized as a part of the map (see: DefaultRequestLogEvent for explanation). If we serialize the query independently then the polymorphic annotation is respected.
Proposed solution
The simples solution is to serialize an object to JsonNode first. If the query is present, then serialize it independently and replace the non-polymorphic version in the JsonNode.
Affected Version
The Druid version where the problem was encountered:
0.22.x,0.23.xDescription
When setting up a request emitter to use KafkaEmitter the
queryTypeproperty is not serialized to a JSON. The problem is located in the method:public void emit(final Event event)ofKafkaEmitter.java.The problem is that the rendering of the JSON string is done on the
Map<String, Object>. The Jackson ignores the polymorphic annotation on the Query class withqueryTypeif the query is serialized as a part of the map (see:DefaultRequestLogEventfor explanation). If we serialize the query independently then the polymorphic annotation is respected.Proposed solution
The simples solution is to serialize an object to JsonNode first. If the
queryis present, then serialize it independently and replace the non-polymorphic version in the JsonNode.