Open
Description
I noticed that lookup in async mode may not work as expected. Namely, when multiple HTTP requests are sent at once in async mode, some of the results seems to be duplicated for other rows.
I believe the root cause is the fact that org.apache.flink.formats.json.JsonRowDataSerializationSchema
is not thread-safe.
/** Reusable object node. */
private transient ObjectNode node;
@Override
public byte[] serialize(RowData row) {
if (node == null) {
node = mapper.createObjectNode();
}
try {
runtimeConverter.convert(mapper, node, row);
return mapper.writeValueAsBytes(node);
} catch (Throwable t) {
throw new RuntimeException(String.format("Could not serialize row '%s'.", row), t);
}
}
The serialization schema is used in com.getindata.connectors.http.internal.table.lookup.querycreators.GenericJsonQueryCreator#createLookupQuery
.