diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/JsonEncodingUtils.java b/core/trino-main/src/main/java/io/trino/server/protocol/JsonEncodingUtils.java index e8c8970e0a32d..9183bb4fb9cb0 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/JsonEncodingUtils.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/JsonEncodingUtils.java @@ -263,7 +263,7 @@ public void encode(JsonGenerator generator, ConnectorSession session, Block bloc return; } Slice slice = VARCHAR.getSlice(block, position); - generator.writeString(slice.toStringUtf8()); + generator.writeUTF8String(slice.byteArray(), slice.byteArrayOffset(), slice.length()); } } @@ -286,7 +286,7 @@ public void encode(JsonGenerator generator, ConnectorSession session, Block bloc return; } Slice slice = padSpaces(VARCHAR.getSlice(block, position), length); - generator.writeString(slice.toStringUtf8()); + generator.writeUTF8String(slice.byteArray(), slice.byteArrayOffset(), slice.length()); } }