Skip to content

Commit dfcc2dd

Browse files
oneonestarmosabua
authored andcommitted
Update aircompressor to v3
1 parent f70f1b5 commit dfcc2dd

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

gateway-ha/pom.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@
109109

110110
<dependency>
111111
<groupId>io.airlift</groupId>
112-
<artifactId>aircompressor</artifactId>
113-
<version>0.27</version>
112+
<artifactId>aircompressor-v3</artifactId>
113+
<version>3.2</version>
114114
</dependency>
115115

116116
<dependency>
@@ -497,6 +497,16 @@
497497
</configuration>
498498
</plugin>
499499

500+
<plugin>
501+
<groupId>org.basepom.maven</groupId>
502+
<artifactId>duplicate-finder-maven-plugin</artifactId>
503+
<configuration>
504+
<ignoredResourcePatterns combine.children="append">
505+
<ignoredResourcePattern>aircompressor.*</ignoredResourcePattern>
506+
</ignoredResourcePatterns>
507+
</configuration>
508+
</plugin>
509+
500510
<plugin>
501511
<groupId>org.apache.maven.plugins</groupId>
502512
<artifactId>maven-resources-plugin</artifactId>

gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueryProperties.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import com.google.common.collect.ImmutableList;
2424
import com.google.common.collect.ImmutableMap;
2525
import com.google.common.collect.ImmutableSet;
26-
import io.airlift.compress.zstd.ZstdDecompressor;
26+
import io.airlift.compress.v3.zstd.ZstdDecompressor;
2727
import io.airlift.json.JsonCodec;
2828
import io.airlift.log.Logger;
2929
import io.trino.sql.parser.ParsingException;
@@ -106,6 +106,7 @@ public class TrinoQueryProperties
106106
private boolean isNewQuerySubmission;
107107
private Optional<String> errorMessage = Optional.empty();
108108
private Optional<String> queryId = Optional.empty();
109+
private final ZstdDecompressor decompressor = ZstdDecompressor.create();
109110

110111
public static final String TRINO_CATALOG_HEADER_NAME = "X-Trino-Catalog";
111112
public static final String TRINO_SCHEMA_HEADER_NAME = "X-Trino-Schema";
@@ -269,8 +270,8 @@ private String decodePreparedStatementFromHeader(String headerValue)
269270
String encoded = headerValue.substring(prefix.length());
270271
byte[] compressed = base64Url().decode(encoded);
271272

272-
byte[] preparedStatement = new byte[toIntExact(ZstdDecompressor.getDecompressedSize(compressed, 0, compressed.length))];
273-
new ZstdDecompressor().decompress(compressed, 0, compressed.length, preparedStatement, 0, preparedStatement.length);
273+
byte[] preparedStatement = new byte[toIntExact(decompressor.getDecompressedSize(compressed, 0, compressed.length))];
274+
decompressor.decompress(compressed, 0, compressed.length, preparedStatement, 0, preparedStatement.length);
274275
return new String(preparedStatement, UTF_8);
275276
}
276277

0 commit comments

Comments
 (0)