From a81506b20be861ccf25571fbc7c0f0c763858fd3 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Tue, 12 Nov 2024 17:58:00 +0100 Subject: [PATCH] Write JSON strings directly from memory --- .../main/java/io/trino/server/protocol/JsonEncodingUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()); } }