presto-main/src/main/java/io/prestosql/metadata/AbstractTypedJacksonModule.java/AbstractTypedJacksonModule/serialize
class AbstractTypedJacksonModule:        @Override
        public void serialize(T value, JsonGenerator generator, SerializerProvider provider)
                throws IOException
        {
            if (value == null) {
                provider.defaultSerializeNull(generator);
                return;
            }

            try {
                Class<?> type = value.getClass();
                JsonSerializer<T> serializer = serializerCache.get(type, () -> createSerializer(provider, type));
                serializer.serializeWithType(value, generator, provider, typeSerializer);
            }
            catch (ExecutionException e) {
                Throwable cause = e.getCause();
                if (cause != null) {
                    throwIfInstanceOf(cause, IOException.class);
                }
                throw new RuntimeException(e);
            }
        }