in presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/JSONSchemaHandler.java [54:74]
public Object deserialize(ByteBuf payload) {
// Since JSON deserializer only works on a byte[] we need to convert a direct mem buffer into
// a byte[].
int size = payload.readableBytes();
byte[] buffer = tmpBuffer.get();
if (buffer.length < size) {
// If the thread-local buffer is not big enough, replace it with
// a bigger one
buffer = new byte[size * 2];
tmpBuffer.set(buffer);
}
payload.readBytes(buffer, 0, size);
try {
return dslJson.deserialize(Map.class, buffer, size);
} catch (IOException e) {
log.error("Failed to deserialize Json object", e);
return null;
}
}