Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions client/trino-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
<artifactId>logging-interceptor</artifactId>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-brotli</artifactId>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-jvm</artifactId>
Expand All @@ -64,6 +69,11 @@
<artifactId>okhttp-urlconnection</artifactId>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-zstd</artifactId>
</dependency>

<dependency>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
import io.trino.client.auth.external.HttpTokenPoller;
import io.trino.client.auth.external.RedirectHandler;
import io.trino.client.auth.external.TokenPoller;
import okhttp3.CompressionInterceptor;
import okhttp3.Gzip;
import okhttp3.OkHttpClient;
import okhttp3.brotli.Brotli;
import okhttp3.zstd.Zstd;

import java.io.File;
import java.time.Duration;
Expand Down Expand Up @@ -126,6 +130,10 @@ public static OkHttpClient.Builder unauthenticatedClientBuilder(TrinoUri uri, St
setupTimeouts(builder, toIntExact(uri.getTimeout().toMillis()), TimeUnit.MILLISECONDS);
setupHttpLogging(builder, uri.getHttpLoggingLevel());

if (!uri.isCompressionDisabled()) {
setupCompression(builder);
}

if (uri.isLocalRedirectDisallowed()) {
builder.addNetworkInterceptor(new DisallowLocalRedirectInterceptor());
}
Expand Down Expand Up @@ -166,6 +174,11 @@ public static OkHttpClient.Builder unauthenticatedClientBuilder(TrinoUri uri, St
return builder;
}

private static void setupCompression(OkHttpClient.Builder builder)
{
builder.addInterceptor(new CompressionInterceptor(Zstd.INSTANCE, Brotli.INSTANCE, Gzip.INSTANCE));
}

protected static void setupUserAgent(OkHttpClient.Builder builder, String userAgent)
{
builder.addInterceptor(userAgent(userAgent));
Expand Down
8 changes: 8 additions & 0 deletions client/trino-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@
<pattern>com.google.thirdparty</pattern>
<shadedPattern>${shadeBase}.guava</shadedPattern>
</relocation>
<relocation>
<pattern>com.squareup</pattern>
<shadedPattern>${shadeBase}.squareup</shadedPattern>
</relocation>
<relocation>
<pattern>io.airlift</pattern>
<shadedPattern>${shadeBase}.airlift</shadedPattern>
Expand All @@ -488,6 +492,10 @@
<pattern>net.bytebuddy</pattern>
<shadedPattern>${shadeBase}.net.bytebuddy</shadedPattern>
</relocation>
<relocation>
<pattern>org.brotli</pattern>
<shadedPattern>${shadeBase}.brotli</shadedPattern>
</relocation>
<relocation>
<pattern>org.joda.time</pattern>
<shadedPattern>${shadeBase}.joda.time</shadedPattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ public void testOpenTelemetryIsNotShaded()

public static boolean isExpectedFile(String filename)
{
return MANIFEST_FILES.contains(filename) || filename.startsWith("io/trino/jdbc") || filename.startsWith("aircompressor/");
return MANIFEST_FILES.contains(filename) || filename.startsWith("io/trino/jdbc") || filename.startsWith("aircompressor/") || filename.startsWith("jni/");
}
}