diff --git a/client/trino-cli/src/main/java/io/trino/cli/ClientOptions.java b/client/trino-cli/src/main/java/io/trino/cli/ClientOptions.java index 3907c702e0c9..ede7772fc6af 100644 --- a/client/trino-cli/src/main/java/io/trino/cli/ClientOptions.java +++ b/client/trino-cli/src/main/java/io/trino/cli/ClientOptions.java @@ -52,7 +52,7 @@ import static io.trino.client.uri.PropertyName.CLIENT_INFO; import static io.trino.client.uri.PropertyName.CLIENT_TAGS; import static io.trino.client.uri.PropertyName.DISABLE_COMPRESSION; -import static io.trino.client.uri.PropertyName.ENCODING_ID; +import static io.trino.client.uri.PropertyName.ENCODING; import static io.trino.client.uri.PropertyName.EXTERNAL_AUTHENTICATION; import static io.trino.client.uri.PropertyName.EXTERNAL_AUTHENTICATION_REDIRECT_HANDLERS; import static io.trino.client.uri.PropertyName.EXTRA_CREDENTIALS; @@ -287,9 +287,9 @@ public class ClientOptions @Option(names = "--disable-compression", description = "Disable compression of query results") public boolean disableCompression; - @PropertyMapping(ENCODING_ID) - @Option(names = "--encoding-id", paramLabel = "", description = "Experimental spooled protocol encoding [available: ${ENCODINGS}]") - public Optional encodingId = Optional.empty(); + @PropertyMapping(ENCODING) + @Option(names = "--encoding", paramLabel = "", description = "Experimental spooled protocol encoding [available: ${ENCODINGS}]") + public Optional encoding = Optional.empty(); @Option(names = "--editing-mode", paramLabel = "", defaultValue = "EMACS", description = "Editing mode [${COMPLETION-CANDIDATES}] " + DEFAULT_VALUE) public EditingMode editingMode; @@ -342,7 +342,7 @@ public ClientSession toClientSession(TrinoUri uri) return uri .toClientSessionBuilder() .source(uri.getSource().orElse(SOURCE_DEFAULT)) - .encodingId(encodingId) + .encoding(encoding) .build(); } diff --git a/client/trino-client/src/main/java/io/trino/client/ClientSession.java b/client/trino-client/src/main/java/io/trino/client/ClientSession.java index da9ccd6a7817..13a0f1a2ea9e 100644 --- a/client/trino-client/src/main/java/io/trino/client/ClientSession.java +++ b/client/trino-client/src/main/java/io/trino/client/ClientSession.java @@ -56,7 +56,7 @@ public class ClientSession private final String transactionId; private final Duration clientRequestTimeout; private final boolean compressionDisabled; - private Optional encodingId; + private Optional encoding; public static Builder builder() { @@ -97,7 +97,7 @@ private ClientSession( String transactionId, Duration clientRequestTimeout, boolean compressionDisabled, - Optional encodingId) + Optional encoding) { this.server = requireNonNull(server, "server is null"); this.principal = requireNonNull(principal, "principal is null"); @@ -120,7 +120,7 @@ private ClientSession( this.extraCredentials = ImmutableMap.copyOf(requireNonNull(extraCredentials, "extraCredentials is null")); this.clientRequestTimeout = clientRequestTimeout; this.compressionDisabled = compressionDisabled; - this.encodingId = requireNonNull(encodingId, "encodingId is null"); + this.encoding = requireNonNull(encoding, "encoding is null"); for (String clientTag : clientTags) { checkArgument(!clientTag.contains(","), "client tag cannot contain ','"); @@ -264,9 +264,9 @@ public boolean isCompressionDisabled() return compressionDisabled; } - public Optional getEncodingId() + public Optional getEncoding() { - return encodingId; + return encoding; } @Override @@ -291,7 +291,7 @@ public String toString() .add("resourceEstimates", resourceEstimates) .add("clientRequestTimeout", clientRequestTimeout) .add("compressionDisabled", compressionDisabled) - .add("encodingId", encodingId) + .add("encoding", encoding) .omitNullValues() .toString(); } @@ -319,7 +319,7 @@ public static final class Builder private String transactionId; private Duration clientRequestTimeout; private boolean compressionDisabled; - private Optional encodingId = Optional.empty(); + private Optional encoding = Optional.empty(); private Builder() {} @@ -347,7 +347,7 @@ private Builder(ClientSession clientSession) transactionId = clientSession.getTransactionId(); clientRequestTimeout = clientSession.getClientRequestTimeout(); compressionDisabled = clientSession.isCompressionDisabled(); - encodingId = clientSession.getEncodingId(); + encoding = clientSession.getEncoding(); } public Builder server(URI server) @@ -476,9 +476,9 @@ public Builder compressionDisabled(boolean compressionDisabled) return this; } - public Builder encodingId(Optional encodingId) + public Builder encoding(Optional encoding) { - this.encodingId = encodingId; + this.encoding = encoding; return this; } @@ -506,7 +506,7 @@ public ClientSession build() transactionId, clientRequestTimeout, compressionDisabled, - encodingId); + encoding); } } } diff --git a/client/trino-client/src/main/java/io/trino/client/QueryDataDecoder.java b/client/trino-client/src/main/java/io/trino/client/QueryDataDecoder.java index 1c098571dd90..0f27563f9766 100644 --- a/client/trino-client/src/main/java/io/trino/client/QueryDataDecoder.java +++ b/client/trino-client/src/main/java/io/trino/client/QueryDataDecoder.java @@ -25,11 +25,11 @@ interface Factory { QueryDataDecoder create(List columns, DataAttributes queryAttributes); - String encodingId(); + String encoding(); } Iterable> decode(InputStream input, DataAttributes segmentAttributes) throws IOException; - String encodingId(); + String encoding(); } diff --git a/client/trino-client/src/main/java/io/trino/client/StatementClientV1.java b/client/trino-client/src/main/java/io/trino/client/StatementClientV1.java index f9a4b3378764..1f322caf0dcc 100644 --- a/client/trino-client/src/main/java/io/trino/client/StatementClientV1.java +++ b/client/trino-client/src/main/java/io/trino/client/StatementClientV1.java @@ -136,7 +136,7 @@ public StatementClientV1(Call.Factory httpCallFactory, Call.Factory segmentHttpC this.compressionDisabled = session.isCompressionDisabled(); this.segmentLoader = new SegmentLoader(requireNonNull(segmentHttpCallFactory, "segmentHttpCallFactory is null")); - Request request = buildQueryRequest(session, query, session.getEncodingId()); + Request request = buildQueryRequest(session, query, session.getEncoding()); // Pass empty as materializedJsonSizeLimit to always materialize the first response // to avoid losing the response body if the initial response parsing fails executeRequest(request, "starting query", OptionalLong.empty(), this::isTransient); @@ -514,14 +514,14 @@ private void processResponse(Headers headers, QueryResults results) EncodedQueryData encodedData = (EncodedQueryData) results.getData(); DataAttributes queryAttributed = encodedData.getMetadata(); if (decoder.get() == null) { - verify(QueryDataDecoders.exists(encodedData.getEncodingId()), "Received encoded data format but there is no decoder matching %s", encodedData.getEncodingId()); + verify(QueryDataDecoders.exists(encodedData.getEncoding()), "Received encoded data format but there is no decoder matching %s", encodedData.getEncoding()); QueryDataDecoder queryDataDecoder = QueryDataDecoders - .get(encodedData.getEncodingId()) + .get(encodedData.getEncoding()) .create(results.getColumns(), queryAttributed); decoder.set(queryDataDecoder); } - verify(decoder.get().encodingId().equals(encodedData.getEncodingId()), "Decoder has wrong encoding id, expected %s, got %s", encodedData.getEncodingId(), decoder.get().encodingId()); + verify(decoder.get().encoding().equals(encodedData.getEncoding()), "Decoder has wrong encoding id, expected %s, got %s", encodedData.getEncoding(), decoder.get().encoding()); } currentResults.set(results); diff --git a/client/trino-client/src/main/java/io/trino/client/spooling/EncodedQueryData.java b/client/trino-client/src/main/java/io/trino/client/spooling/EncodedQueryData.java index 422706725954..9dc2117dbbee 100644 --- a/client/trino-client/src/main/java/io/trino/client/spooling/EncodedQueryData.java +++ b/client/trino-client/src/main/java/io/trino/client/spooling/EncodedQueryData.java @@ -39,22 +39,22 @@ public class EncodedQueryData implements QueryData { - private final String encodingId; + private final String encoding; private final DataAttributes metadata; private final List segments; @JsonCreator public EncodedQueryData( - @JsonProperty("encodingId") String encodingId, + @JsonProperty("encoding") String encoding, @JsonProperty("metadata") Map metadata, @JsonProperty("segments") List segments) { - this(encodingId, new DataAttributes(metadata), segments); + this(encoding, new DataAttributes(metadata), segments); } - public EncodedQueryData(String encodingId, DataAttributes metadata, List segments) + public EncodedQueryData(String encoding, DataAttributes metadata, List segments) { - this.encodingId = requireNonNull(encodingId, "encodingId is null"); + this.encoding = requireNonNull(encoding, "encoding is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.segments = ImmutableList.copyOf(requireNonNull(segments, "segments is null")); } @@ -65,10 +65,10 @@ public List getSegments() return segments; } - @JsonProperty("encodingId") - public String getEncodingId() + @JsonProperty("encoding") + public String getEncoding() { - return encodingId; + return encoding; } @JsonInclude(JsonInclude.Include.NON_EMPTY) @@ -92,8 +92,8 @@ public Iterable> getData() public QueryData toRawData(QueryDataDecoder decoder, SegmentLoader segmentLoader) { - if (!decoder.encodingId().equals(encodingId)) { - throw new IllegalArgumentException(format("Invalid decoder supplied, expected %s, got %s", encodingId, decoder.encodingId())); + if (!decoder.encoding().equals(encoding)) { + throw new IllegalArgumentException(format("Invalid decoder supplied, expected %s, got %s", encoding, decoder.encoding())); } return RawQueryData.of(unmodifiableIterable(concat(transform(segments, segment -> { @@ -125,7 +125,7 @@ public QueryData toRawData(QueryDataDecoder decoder, SegmentLoader segmentLoader public String toString() { return toStringHelper(this) - .add("encodingId", encodingId) + .add("encoding", encoding) .add("segments", segments) .add("metadata", metadata.attributes.keySet()) .toString(); @@ -138,13 +138,13 @@ public static Builder builder(String format) public static class Builder { - private final String encodingId; + private final String encoding; private final ImmutableList.Builder segments = ImmutableList.builder(); private DataAttributes metadata = DataAttributes.empty(); - private Builder(String encodingId) + private Builder(String encoding) { - this.encodingId = requireNonNull(encodingId, "encodingId is null"); + this.encoding = requireNonNull(encoding, "encoding is null"); } public Builder withSegment(Segment segment) @@ -161,7 +161,7 @@ public Builder withAttributes(DataAttributes attributes) public EncodedQueryData build() { - return new EncodedQueryData(encodingId, metadata, segments.build()); + return new EncodedQueryData(encoding, metadata, segments.build()); } } } diff --git a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataDecoder.java b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataDecoder.java index e06b2972814d..358ef396b86c 100644 --- a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataDecoder.java +++ b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/JsonQueryDataDecoder.java @@ -53,7 +53,7 @@ public Iterable> decode(InputStream stream, DataAttributes attribut } @Override - public String encodingId() + public String encoding() { return "json"; } @@ -68,7 +68,7 @@ public QueryDataDecoder create(List columns, DataAttributes queryAttribu } @Override - public String encodingId() + public String encoding() { return "json"; } @@ -84,9 +84,9 @@ public QueryDataDecoder create(List columns, DataAttributes queryAttribu } @Override - public String encodingId() + public String encoding() { - return super.encodingId() + "+zstd"; + return super.encoding() + "+zstd"; } } @@ -100,9 +100,9 @@ public QueryDataDecoder create(List columns, DataAttributes queryAttribu } @Override - public String encodingId() + public String encoding() { - return super.encodingId() + "+lz4"; + return super.encoding() + "+lz4"; } } diff --git a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/Lz4QueryDataDecoder.java b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/Lz4QueryDataDecoder.java index 189af55f8526..8e1ebbe54cb5 100644 --- a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/Lz4QueryDataDecoder.java +++ b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/Lz4QueryDataDecoder.java @@ -47,8 +47,8 @@ InputStream decompress(InputStream stream, int uncompressedSize) } @Override - public String encodingId() + public String encoding() { - return delegate.encodingId() + "+lz4"; + return delegate.encoding() + "+lz4"; } } diff --git a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/QueryDataDecoders.java b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/QueryDataDecoders.java index c53713846775..3e71adc4d084 100644 --- a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/QueryDataDecoders.java +++ b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/QueryDataDecoders.java @@ -35,20 +35,20 @@ public class QueryDataDecoders private QueryDataDecoders() {} - public static Factory get(String encodingId) + public static Factory get(String encoding) { - if (!encodingMap.containsKey(encodingId)) { - throw new IllegalArgumentException("Unknown encoding id: " + encodingId); + if (!encodingMap.containsKey(encoding)) { + throw new IllegalArgumentException("Unknown encoding: " + encoding); } - Factory factory = encodingMap.get(encodingId); - verify(factory.encodingId().equals(encodingId), "Factory has wrong encoding id, expected %s, got %s", encodingId, factory.encodingId()); + Factory factory = encodingMap.get(encoding); + verify(factory.encoding().equals(encoding), "Factory has wrong encoding, expected %s, got %s", encoding, factory.encoding()); return factory; } - public static boolean exists(String encodingId) + public static boolean exists(String encoding) { - return encodingMap.containsKey(encodingId); + return encodingMap.containsKey(encoding); } public static Set getSupportedEncodings() @@ -59,6 +59,6 @@ public static Set getSupportedEncodings() private static Map factoriesMap() { return decoders.stream() - .collect(toImmutableMap(Factory::encodingId, identity())); + .collect(toImmutableMap(Factory::encoding, identity())); } } diff --git a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/ZstdQueryDataDecoder.java b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/ZstdQueryDataDecoder.java index 922251f62387..696ae3631920 100644 --- a/client/trino-client/src/main/java/io/trino/client/spooling/encoding/ZstdQueryDataDecoder.java +++ b/client/trino-client/src/main/java/io/trino/client/spooling/encoding/ZstdQueryDataDecoder.java @@ -33,8 +33,8 @@ InputStream decompress(InputStream inputStream, int uncompressedSize) } @Override - public String encodingId() + public String encoding() { - return delegate.encodingId() + "+zstd"; + return delegate.encoding() + "+zstd"; } } diff --git a/client/trino-client/src/main/java/io/trino/client/uri/ConnectionProperties.java b/client/trino-client/src/main/java/io/trino/client/uri/ConnectionProperties.java index 8713f907e212..cbabdc638640 100644 --- a/client/trino-client/src/main/java/io/trino/client/uri/ConnectionProperties.java +++ b/client/trino-client/src/main/java/io/trino/client/uri/ConnectionProperties.java @@ -69,7 +69,7 @@ enum SslVerificationMode public static final ConnectionProperty HTTP_PROXY = new HttpProxy(); public static final ConnectionProperty APPLICATION_NAME_PREFIX = new ApplicationNamePrefix(); public static final ConnectionProperty DISABLE_COMPRESSION = new DisableCompression(); - public static final ConnectionProperty ENCODING_ID = new EncodingId(); + public static final ConnectionProperty ENCODING = new Encoding(); public static final ConnectionProperty ASSUME_LITERAL_NAMES_IN_METADATA_CALLS_FOR_NON_CONFORMING_CLIENTS = new AssumeLiteralNamesInMetadataCallsForNonConformingClients(); public static final ConnectionProperty ASSUME_LITERAL_UNDERSCORE_IN_METADATA_CALLS_FOR_NON_CONFORMING_CLIENTS = new AssumeLiteralUnderscoreInMetadataCallsForNonConformingClients(); public static final ConnectionProperty SSL = new Ssl(); @@ -129,7 +129,7 @@ enum SslVerificationMode .add(DISABLE_COMPRESSION) .add(DNS_RESOLVER) .add(DNS_RESOLVER_CONTEXT) - .add(ENCODING_ID) + .add(ENCODING) .add(EXPLICIT_PREPARE) .add(EXTERNAL_AUTHENTICATION) .add(EXTERNAL_AUTHENTICATION_REDIRECT_HANDLERS) @@ -380,22 +380,22 @@ public DisableCompression() } } - private static class EncodingId + private static class Encoding extends AbstractConnectionProperty { - public EncodingId() + public Encoding() { - super(PropertyName.ENCODING_ID, NOT_REQUIRED, EncodingId::areEncodingsValid, STRING_CONVERTER); + super(PropertyName.ENCODING, NOT_REQUIRED, Encoding::areEncodingsValid, STRING_CONVERTER); } public static Optional areEncodingsValid(Properties properties) { List supportedEncodings = Splitter.on(",").trimResults().omitEmptyStrings() - .splitToList(ENCODING_ID.getRequiredValue(properties)); + .splitToList(ENCODING.getRequiredValue(properties)); - for (String encodingId : supportedEncodings) { - if (!QueryDataDecoders.exists(encodingId)) { - return Optional.of("Unknown encoding id: " + encodingId); + for (String encoding : supportedEncodings) { + if (!QueryDataDecoders.exists(encoding)) { + return Optional.of("Unknown encoding: " + encoding); } } return Optional.empty(); diff --git a/client/trino-client/src/main/java/io/trino/client/uri/PropertyName.java b/client/trino-client/src/main/java/io/trino/client/uri/PropertyName.java index eeb302fcee17..c22184ecf9cf 100644 --- a/client/trino-client/src/main/java/io/trino/client/uri/PropertyName.java +++ b/client/trino-client/src/main/java/io/trino/client/uri/PropertyName.java @@ -33,7 +33,7 @@ public enum PropertyName DISABLE_COMPRESSION("disableCompression"), DNS_RESOLVER("dnsResolver"), DNS_RESOLVER_CONTEXT("dnsResolverContext"), - ENCODING_ID("encodingId"), + ENCODING("encoding"), EXPLICIT_PREPARE("explicitPrepare"), EXTERNAL_AUTHENTICATION("externalAuthentication"), EXTERNAL_AUTHENTICATION_REDIRECT_HANDLERS("externalAuthenticationRedirectHandlers"), diff --git a/client/trino-client/src/main/java/io/trino/client/uri/TrinoUri.java b/client/trino-client/src/main/java/io/trino/client/uri/TrinoUri.java index 5639a400a034..435de6dd5405 100644 --- a/client/trino-client/src/main/java/io/trino/client/uri/TrinoUri.java +++ b/client/trino-client/src/main/java/io/trino/client/uri/TrinoUri.java @@ -52,7 +52,7 @@ import static io.trino.client.uri.ConnectionProperties.DISABLE_COMPRESSION; import static io.trino.client.uri.ConnectionProperties.DNS_RESOLVER; import static io.trino.client.uri.ConnectionProperties.DNS_RESOLVER_CONTEXT; -import static io.trino.client.uri.ConnectionProperties.ENCODING_ID; +import static io.trino.client.uri.ConnectionProperties.ENCODING; import static io.trino.client.uri.ConnectionProperties.EXPLICIT_PREPARE; import static io.trino.client.uri.ConnectionProperties.EXTERNAL_AUTHENTICATION; import static io.trino.client.uri.ConnectionProperties.EXTERNAL_AUTHENTICATION_REDIRECT_HANDLERS; @@ -421,9 +421,9 @@ public boolean isCompressionDisabled() return resolveWithDefault(DISABLE_COMPRESSION, false); } - public Optional getEncodingId() + public Optional getEncoding() { - return resolveOptional(ENCODING_ID); + return resolveOptional(ENCODING); } public boolean isAssumeLiteralNamesInMetadataCallsForNonConformingClients() @@ -508,7 +508,7 @@ public ClientSession.Builder toClientSessionBuilder() .transactionId(null) .resourceEstimates(getResourceEstimates()) .compressionDisabled(isCompressionDisabled()) - .encodingId(getEncodingId()); + .encoding(getEncoding()); } protected static Set> allProperties() @@ -802,9 +802,9 @@ public Builder setDisableCompression(Boolean disableCompression) return setProperty(DISABLE_COMPRESSION, requireNonNull(disableCompression, "disableCompression is null")); } - public Builder setEncodingId(String encodingId) + public Builder setEncoding(String encoding) { - return setProperty(ENCODING_ID, requireNonNull(encodingId, "encodingId is null")); + return setProperty(ENCODING, requireNonNull(encoding, "encoding is null")); } public Builder setAssumeLiteralNamesInMetadataCallsForNonConformingClients(boolean value) diff --git a/client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java b/client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java index c1d9a2f5ed80..2711c33baf9b 100644 --- a/client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java +++ b/client/trino-jdbc/src/main/java/io/trino/jdbc/TrinoConnection.java @@ -103,7 +103,7 @@ public class TrinoConnection private final URI httpUri; private final Optional user; private final boolean compressionDisabled; - private final Optional encodingId; + private final Optional encoding; private final boolean assumeLiteralNamesInMetadataCallsForNonConformingClients; private final boolean assumeLiteralUnderscoreInMetadataCallsForNonConformingClients; private final Map extraCredentials; @@ -133,7 +133,7 @@ public class TrinoConnection this.source = uri.getSource(); this.extraCredentials = uri.getExtraCredentials(); this.compressionDisabled = uri.isCompressionDisabled(); - this.encodingId = uri.getEncodingId(); + this.encoding = uri.getEncoding(); this.assumeLiteralNamesInMetadataCallsForNonConformingClients = uri.isAssumeLiteralNamesInMetadataCallsForNonConformingClients(); if (this.assumeLiteralNamesInMetadataCallsForNonConformingClients) { @@ -775,7 +775,7 @@ StatementClient startQuery(String sql, Map sessionPropertiesOver .transactionId(transactionId.get()) .clientRequestTimeout(timeout) .compressionDisabled(compressionDisabled) - .encodingId(encodingId) + .encoding(encoding) .build(); return newStatementClient(httpCallFactory, segmentHttpCallFactory, session, sql); diff --git a/core/trino-main/src/main/java/io/trino/Session.java b/core/trino-main/src/main/java/io/trino/Session.java index fc049e7b25b7..6aeaab959048 100644 --- a/core/trino-main/src/main/java/io/trino/Session.java +++ b/core/trino-main/src/main/java/io/trino/Session.java @@ -91,7 +91,7 @@ public final class Session private final Map preparedStatements; private final ProtocolHeaders protocolHeaders; private final Optional exchangeEncryptionKey; - private final Optional queryDataEncodingId; + private final Optional queryDataEncoding; public Session( QueryId queryId, @@ -120,7 +120,7 @@ public Session( Map preparedStatements, ProtocolHeaders protocolHeaders, Optional exchangeEncryptionKey, - Optional queryDataEncodingId) + Optional queryDataEncoding) { this.queryId = requireNonNull(queryId, "queryId is null"); this.querySpan = requireNonNull(querySpan, "querySpan is null"); @@ -147,7 +147,7 @@ public Session( this.preparedStatements = requireNonNull(preparedStatements, "preparedStatements is null"); this.protocolHeaders = requireNonNull(protocolHeaders, "protocolHeaders is null"); this.exchangeEncryptionKey = requireNonNull(exchangeEncryptionKey, "exchangeEncryptionKey is null"); - this.queryDataEncodingId = requireNonNull(queryDataEncodingId, "queryDataEncodingId is null"); + this.queryDataEncoding = requireNonNull(queryDataEncoding, "queryDataEncoding is null"); requireNonNull(catalogProperties, "catalogProperties is null"); ImmutableMap.Builder> catalogPropertiesBuilder = ImmutableMap.builder(); @@ -317,9 +317,9 @@ public Optional getExchangeEncryptionKey() return exchangeEncryptionKey; } - public Optional getQueryDataEncodingId() + public Optional getQueryDataEncoding() { - return queryDataEncodingId; + return queryDataEncoding; } public SessionPropertyManager getSessionPropertyManager() @@ -393,7 +393,7 @@ public Session beginTransactionId(TransactionId transactionId, TransactionManage preparedStatements, protocolHeaders, exchangeEncryptionKey, - queryDataEncodingId); + queryDataEncoding); } public Session withDefaultProperties(Map systemPropertyDefaults, Map> catalogPropertyDefaults, AccessControl accessControl) @@ -443,7 +443,7 @@ public Session withDefaultProperties(Map systemPropertyDefaults, preparedStatements, protocolHeaders, exchangeEncryptionKey, - queryDataEncodingId); + queryDataEncoding); } public Session withExchangeEncryption(Slice encryptionKey) @@ -476,7 +476,7 @@ public Session withExchangeEncryption(Slice encryptionKey) preparedStatements, protocolHeaders, Optional.of(encryptionKey), - queryDataEncodingId); + queryDataEncoding); } public ConnectorSession toConnectorSession() @@ -530,7 +530,7 @@ public SessionRepresentation toSessionRepresentation() identity.getCatalogRoles(), preparedStatements, protocolHeaders.getProtocolName(), - queryDataEncodingId); + queryDataEncoding); } @Override @@ -660,7 +660,7 @@ public static class SessionBuilder private String clientInfo; private Set clientTags = ImmutableSet.of(); private Set clientCapabilities = ImmutableSet.of(); - private Optional queryDataEncodingId = Optional.empty(); + private Optional queryDataEncoding = Optional.empty(); private ResourceEstimates resourceEstimates; private Instant start = Instant.now(); private final Map systemProperties = new HashMap<>(); @@ -695,7 +695,7 @@ private SessionBuilder(Session session) this.userAgent = session.userAgent.orElse(null); this.clientInfo = session.clientInfo.orElse(null); this.clientCapabilities = ImmutableSet.copyOf(session.clientCapabilities); - this.queryDataEncodingId = session.queryDataEncodingId; + this.queryDataEncoding = session.queryDataEncoding; this.clientTags = ImmutableSet.copyOf(session.clientTags); this.start = session.start; this.systemProperties.putAll(session.systemProperties); @@ -944,9 +944,9 @@ public SessionBuilder setProtocolHeaders(ProtocolHeaders protocolHeaders) return this; } - public SessionBuilder setQueryDataEncodingId(Optional value) + public SessionBuilder setQueryDataEncoding(Optional value) { - this.queryDataEncodingId = value; + this.queryDataEncoding = value; return this; } @@ -979,7 +979,7 @@ public Session build() preparedStatements, protocolHeaders, Optional.empty(), - queryDataEncodingId); + queryDataEncoding); } } diff --git a/core/trino-main/src/main/java/io/trino/SessionRepresentation.java b/core/trino-main/src/main/java/io/trino/SessionRepresentation.java index 1915da30719c..caf538014874 100644 --- a/core/trino-main/src/main/java/io/trino/SessionRepresentation.java +++ b/core/trino-main/src/main/java/io/trino/SessionRepresentation.java @@ -71,7 +71,7 @@ public final class SessionRepresentation private final Map catalogRoles; private final Map preparedStatements; private final String protocolName; - private final Optional queryDataEncodingId; + private final Optional queryDataEncoding; @JsonCreator public SessionRepresentation( @@ -104,7 +104,7 @@ public SessionRepresentation( @JsonProperty("catalogRoles") Map catalogRoles, @JsonProperty("preparedStatements") Map preparedStatements, @JsonProperty("protocolName") String protocolName, - @JsonProperty("queryDataEncodingId") Optional queryDataEncodingId) + @JsonProperty("queryDataEncoding") Optional queryDataEncoding) { this.queryId = requireNonNull(queryId, "queryId is null"); this.querySpan = requireNonNull(querySpan, "querySpan is null"); @@ -134,7 +134,7 @@ public SessionRepresentation( this.catalogRoles = ImmutableMap.copyOf(catalogRoles); this.preparedStatements = ImmutableMap.copyOf(preparedStatements); this.protocolName = requireNonNull(protocolName, "protocolName is null"); - this.queryDataEncodingId = requireNonNull(queryDataEncodingId, "queryDataEncodingId is null"); + this.queryDataEncoding = requireNonNull(queryDataEncoding, "queryDataEncoding is null"); ImmutableMap.Builder> catalogPropertiesBuilder = ImmutableMap.builder(); for (Entry> entry : catalogProperties.entrySet()) { @@ -324,9 +324,9 @@ public String getTimeZone() } @JsonProperty - public Optional getQueryDataEncodingId() + public Optional getQueryDataEncoding() { - return queryDataEncodingId; + return queryDataEncoding; } public Identity toIdentity() @@ -388,6 +388,6 @@ public Session toSession(SessionPropertyManager sessionPropertyManager, Map encodingId, + Optional encoding, Optional errorCode, long elapsedMillis, long planningMillis, @@ -694,7 +694,7 @@ private static void logQueryTimeline( finishingMillis, queryStartTime, queryEndTime, - encodingId.map(id -> " :: " + id).orElse("")); + encoding.map(id -> " :: " + id).orElse("")); } private static List getCpuDistributions(QueryInfo queryInfo) diff --git a/core/trino-main/src/main/java/io/trino/operator/OutputSpoolingOperatorFactory.java b/core/trino-main/src/main/java/io/trino/operator/OutputSpoolingOperatorFactory.java index 2bb1ebac6253..0f60fc3c2d4c 100644 --- a/core/trino-main/src/main/java/io/trino/operator/OutputSpoolingOperatorFactory.java +++ b/core/trino-main/src/main/java/io/trino/operator/OutputSpoolingOperatorFactory.java @@ -271,7 +271,7 @@ private Page spool(List pages, boolean finished) userMemoryContext.setBytes(bufferedOutput.size()); // Update memory to actual segment size SpooledSegmentHandle segmentHandle = spoolingManager.create(new SpoolingContext( - queryDataEncoder.encodingId(), + queryDataEncoder.encoding(), operatorContext.getDriverContext().getSession().getQueryId(), rows, bufferedOutput.size())); diff --git a/core/trino-main/src/main/java/io/trino/server/HttpRequestSessionContextFactory.java b/core/trino-main/src/main/java/io/trino/server/HttpRequestSessionContextFactory.java index c2cef70d4fc6..2bb5e9ef2310 100644 --- a/core/trino-main/src/main/java/io/trino/server/HttpRequestSessionContextFactory.java +++ b/core/trino-main/src/main/java/io/trino/server/HttpRequestSessionContextFactory.java @@ -120,10 +120,10 @@ public SessionContext createSessionContext( Optional timeZoneId = Optional.ofNullable(headers.getFirst(protocolHeaders.requestTimeZone())); Optional language = Optional.ofNullable(headers.getFirst(protocolHeaders.requestLanguage())); Optional clientInfo = Optional.ofNullable(headers.getFirst(protocolHeaders.requestClientInfo())); - Optional queryDataEncodingId = Optional.ofNullable(headers.getFirst(protocolHeaders.requestQueryDataEncoding())) + Optional queryDataEncoding = Optional.ofNullable(headers.getFirst(protocolHeaders.requestQueryDataEncoding())) .map(Splitter.on(',').trimResults().omitEmptyStrings()::splitToList) .flatMap(encoderSelector::select) - .map(QueryDataEncoder.Factory::encodingId); + .map(QueryDataEncoder.Factory::encoding); Set clientTags = parseClientTags(protocolHeaders, headers); Set clientCapabilities = parseClientCapabilities(protocolHeaders, headers); @@ -186,7 +186,7 @@ case ParsedSessionPropertyName(Optional catalogName, String propertyName transactionId, clientTransactionSupport, clientInfo, - queryDataEncodingId); + queryDataEncoding); } public Identity extractAuthorizedIdentity(HttpServletRequest servletRequest, HttpHeaders httpHeaders) diff --git a/core/trino-main/src/main/java/io/trino/server/QuerySessionSupplier.java b/core/trino-main/src/main/java/io/trino/server/QuerySessionSupplier.java index 6557cfa3f242..1de68c23abdd 100644 --- a/core/trino-main/src/main/java/io/trino/server/QuerySessionSupplier.java +++ b/core/trino-main/src/main/java/io/trino/server/QuerySessionSupplier.java @@ -113,7 +113,7 @@ public Session createSession(QueryId queryId, Span querySpan, SessionContext con .setTraceToken(context.getTraceToken()) .setResourceEstimates(context.getResourceEstimates()) .setProtocolHeaders(context.getProtocolHeaders()) - .setQueryDataEncodingId(context.getQueryDataEncodingId()); + .setQueryDataEncoding(context.getQueryDataEncoding()); if (context.getCatalog().isPresent()) { sessionBuilder.setCatalog(context.getCatalog()); diff --git a/core/trino-main/src/main/java/io/trino/server/SessionContext.java b/core/trino-main/src/main/java/io/trino/server/SessionContext.java index 074ac41605e4..9276e6432a58 100644 --- a/core/trino-main/src/main/java/io/trino/server/SessionContext.java +++ b/core/trino-main/src/main/java/io/trino/server/SessionContext.java @@ -62,7 +62,7 @@ public class SessionContext private final Optional transactionId; private final boolean clientTransactionSupport; private final Optional clientInfo; - private final Optional queryDataEncodingId; + private final Optional queryDataEncoding; public SessionContext( ProtocolHeaders protocolHeaders, @@ -88,7 +88,7 @@ public SessionContext( Optional transactionId, boolean clientTransactionSupport, Optional clientInfo, - Optional queryDataEncodingId) + Optional queryDataEncoding) { this.protocolHeaders = requireNonNull(protocolHeaders, "protocolHeaders is null"); this.catalog = requireNonNull(catalog, "catalog is null"); @@ -115,7 +115,7 @@ public SessionContext( this.transactionId = requireNonNull(transactionId, "transactionId is null"); this.clientTransactionSupport = clientTransactionSupport; this.clientInfo = requireNonNull(clientInfo, "clientInfo is null"); - this.queryDataEncodingId = requireNonNull(queryDataEncodingId, "queryDataEncodingId is null"); + this.queryDataEncoding = requireNonNull(queryDataEncoding, "queryDataEncoding is null"); } public ProtocolHeaders getProtocolHeaders() @@ -233,9 +233,9 @@ public Optional getTraceToken() return traceToken; } - public Optional getQueryDataEncodingId() + public Optional getQueryDataEncoding() { - return queryDataEncodingId; + return queryDataEncoding; } @VisibleForTesting @@ -279,6 +279,6 @@ else if (enabledRoles.size() == 1) { session.getTransactionId(), session.isClientTransactionSupport(), session.getClientInfo(), - session.getQueryDataEncodingId()); + session.getQueryDataEncoding()); } } diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/ExecutingStatementResource.java b/core/trino-main/src/main/java/io/trino/server/protocol/ExecutingStatementResource.java index 82fa04e4fcfe..3f6a66637d44 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/ExecutingStatementResource.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/ExecutingStatementResource.java @@ -197,7 +197,7 @@ protected Query getQuery(QueryId queryId, String slug, long token) throw new NotFoundException("Query not found"); } - Optional encoderFactory = session.getQueryDataEncodingId() + Optional encoderFactory = session.getQueryDataEncoding() .map(encoders::get); query = queries.computeIfAbsent(queryId, _ -> Query.create( diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/PreferredQueryDataEncoderSelector.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/PreferredQueryDataEncoderSelector.java index 0e1553881000..8bd12a349345 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/PreferredQueryDataEncoderSelector.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/PreferredQueryDataEncoderSelector.java @@ -36,19 +36,19 @@ public PreferredQueryDataEncoderSelector(QueryDataEncoders encoders, SpoolingMan } @Override - public Optional select(List encodingIds) + public Optional select(List encodings) { if (spoolingManagerRegistry.getSpoolingManager().isEmpty()) { - log.debug("Client requested one of the spooled encodings '%s' but spooling is disabled", encodingIds); + log.debug("Client requested one of the spooled encodings '%s' but spooling is disabled", encodings); return Optional.empty(); } - for (String encodingId : encodingIds) { - if (encoders.exists(encodingId)) { - return Optional.of(encoders.get(encodingId)); + for (String encoding : encodings) { + if (encoders.exists(encoding)) { + return Optional.of(encoders.get(encoding)); } } - log.warn("Requested one of the spooled encodings: %s, but these are only available: %s", encodingIds, encoders.getAvailableEncodings()); + log.warn("Requested one of the spooled encodings: %s, but these are only available: %s", encodings, encoders.getAvailableEncodings()); return Optional.empty(); } } diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoder.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoder.java index fbd9cd1c9492..14e3d6db90a7 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoder.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoder.java @@ -29,13 +29,13 @@ interface Factory { QueryDataEncoder create(Session session, List columns); - String encodingId(); + String encoding(); } DataAttributes encodeTo(OutputStream output, List pages) throws IOException; - String encodingId(); + String encoding(); /** * Returns additional attributes that are passed to the QueryDataDecoder.Factory.create method. @@ -55,7 +55,7 @@ default DataAttributes attributes() @FunctionalInterface interface EncoderSelector { - Optional select(List encodingIds); + Optional select(List encoding); static EncoderSelector noEncoder() { diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoders.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoders.java index 3259d51823e1..942cca75e1cc 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoders.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/QueryDataEncoders.java @@ -30,22 +30,22 @@ public QueryDataEncoders(Set factories) { this.factories = requireNonNull(factories, "factories is null") .stream() - .map(factory -> Map.entry(factory.encodingId(), factory)) + .map(factory -> Map.entry(factory.encoding(), factory)) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); } - public boolean exists(String encodingId) + public boolean exists(String encoding) { - return factories.containsKey(encodingId); + return factories.containsKey(encoding); } - public QueryDataEncoder.Factory get(String encodingId) + public QueryDataEncoder.Factory get(String encoding) { - if (!exists(encodingId)) { - throw new IllegalArgumentException("Unknown query data encoder: " + encodingId); + if (!exists(encoding)) { + throw new IllegalArgumentException("Unknown encoding: " + encoding); } - return factories.get(encodingId); + return factories.get(encoding); } public Set getAvailableEncodings() diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/SpooledQueryDataProducer.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/SpooledQueryDataProducer.java index c5ac5fb82b30..fd4b189fcbd8 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/SpooledQueryDataProducer.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/SpooledQueryDataProducer.java @@ -64,7 +64,7 @@ public QueryData produce(ExternalUriInfo uriInfo, Session session, QueryResultRo UriBuilder uriBuilder = spooledSegmentUriBuilder(uriInfo); QueryDataEncoder encoder = encoderFactory.create(session, rows.getOutputColumns().orElseThrow()); - EncodedQueryData.Builder builder = EncodedQueryData.builder(encoder.encodingId()); + EncodedQueryData.Builder builder = EncodedQueryData.builder(encoder.encoding()); List outputColumns = rows.getOutputColumns().orElseThrow(); if (metadataWritten.compareAndSet(false, true)) { diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/JsonQueryDataEncoder.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/JsonQueryDataEncoder.java index 08a5dcb31600..316402e52ab6 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/JsonQueryDataEncoder.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/JsonQueryDataEncoder.java @@ -47,7 +47,7 @@ public class JsonQueryDataEncoder implements QueryDataEncoder { - private static final String ENCODING_ID = "json"; + private static final String ENCODING = "json"; private final Session session; private final List columns; private final ObjectMapper mapper; @@ -132,9 +132,9 @@ private static void writeValue(ObjectMapper mapper, JsonGenerator generator, Obj } @Override - public String encodingId() + public String encoding() { - return ENCODING_ID; + return ENCODING; } public static class Factory @@ -157,9 +157,9 @@ public QueryDataEncoder create(Session session, List columns) } @Override - public String encodingId() + public String encoding() { - return ENCODING_ID; + return ENCODING; } } @@ -179,9 +179,9 @@ public QueryDataEncoder create(Session session, List columns) } @Override - public String encodingId() + public String encoding() { - return super.encodingId() + "+zstd"; + return super.encoding() + "+zstd"; } } @@ -201,9 +201,9 @@ public QueryDataEncoder create(Session session, List columns) } @Override - public String encodingId() + public String encoding() { - return super.encodingId() + "+lz4"; + return super.encoding() + "+lz4"; } } } diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/Lz4QueryDataEncoder.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/Lz4QueryDataEncoder.java index 996bdc7bd918..07488eba52e5 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/Lz4QueryDataEncoder.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/Lz4QueryDataEncoder.java @@ -41,8 +41,8 @@ protected int compress(byte[] buffer, int uncompressedSize, OutputStream output) } @Override - public String encodingId() + public String encoding() { - return delegate.encodingId() + "+lz4"; + return delegate.encoding() + "+lz4"; } } diff --git a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/ZstdQueryDataEncoder.java b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/ZstdQueryDataEncoder.java index 238da599ccb5..e916916a07bc 100644 --- a/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/ZstdQueryDataEncoder.java +++ b/core/trino-main/src/main/java/io/trino/server/protocol/spooling/encoding/ZstdQueryDataEncoder.java @@ -41,8 +41,8 @@ protected int compress(byte[] buffer, int uncompressedSize, OutputStream output) } @Override - public String encodingId() + public String encoding() { - return delegate.encodingId() + "+zstd"; + return delegate.encoding() + "+zstd"; } } diff --git a/core/trino-main/src/main/java/io/trino/server/ui/TrimmedBasicQueryInfo.java b/core/trino-main/src/main/java/io/trino/server/ui/TrimmedBasicQueryInfo.java index 610bc9c4a9e3..ab2cff5e9300 100644 --- a/core/trino-main/src/main/java/io/trino/server/ui/TrimmedBasicQueryInfo.java +++ b/core/trino-main/src/main/java/io/trino/server/ui/TrimmedBasicQueryInfo.java @@ -41,7 +41,7 @@ public class TrimmedBasicQueryInfo private final Optional sessionPrincipal; private final Optional sessionSource; private final Optional resourceGroupId; - private final Optional queryDataEncodingId; + private final Optional queryDataEncoding; private final QueryState state; private final boolean scheduled; private final URI self; @@ -61,7 +61,7 @@ public TrimmedBasicQueryInfo(BasicQueryInfo queryInfo) this.sessionPrincipal = requireNonNull(queryInfo.getSession().getPrincipal(), "principal is null"); this.sessionSource = requireNonNull(queryInfo.getSession().getSource(), "source is null"); this.resourceGroupId = requireNonNull(queryInfo.getResourceGroupId(), "resourceGroupId is null"); - this.queryDataEncodingId = requireNonNull(queryInfo.getSession().getQueryDataEncodingId(), "queryDataEncodingId is null"); + this.queryDataEncoding = requireNonNull(queryInfo.getSession().getQueryDataEncoding(), "queryDataEncoding is null"); this.state = requireNonNull(queryInfo.getState(), "state is null"); this.errorType = Optional.ofNullable(queryInfo.getErrorType()); this.errorCode = Optional.ofNullable(queryInfo.getErrorCode()); @@ -112,9 +112,9 @@ public Optional getResourceGroupId() } @JsonProperty - public Optional getQueryDataEncodingId() + public Optional getQueryDataEncoding() { - return queryDataEncodingId; + return queryDataEncoding; } @JsonProperty diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java b/core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java index 4f23287b6210..a77c05b93a9a 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java @@ -973,7 +973,7 @@ public PhysicalOperation visitOutput(OutputNode node, LocalExecutionPlanContext { Session session = context.taskContext.getSession(); Optional encoderFactory = session - .getQueryDataEncodingId() + .getQueryDataEncoding() .map(encoders::get); PhysicalOperation operation = node.getSource().accept(this, context); diff --git a/core/trino-main/src/main/java/io/trino/sql/planner/LogicalPlanner.java b/core/trino-main/src/main/java/io/trino/sql/planner/LogicalPlanner.java index 6a5916612af6..fd108f522d4a 100644 --- a/core/trino-main/src/main/java/io/trino/sql/planner/LogicalPlanner.java +++ b/core/trino-main/src/main/java/io/trino/sql/planner/LogicalPlanner.java @@ -909,7 +909,7 @@ private PlanNode createOutputPlan(RelationPlan plan, Analysis analysis) columnNumber++; } - if (session.getQueryDataEncodingId().isPresent() && spoolingManagerRegistry.getSpoolingManager().isPresent()) { + if (session.getQueryDataEncoding().isPresent() && spoolingManagerRegistry.getSpoolingManager().isPresent()) { names.add(SPOOLING_METADATA_SYMBOL.name()); outputs.add(SPOOLING_METADATA_SYMBOL); } diff --git a/core/trino-main/src/main/java/io/trino/testing/PlanTester.java b/core/trino-main/src/main/java/io/trino/testing/PlanTester.java index acb0d09d4d70..7fcee3d4f7c3 100644 --- a/core/trino-main/src/main/java/io/trino/testing/PlanTester.java +++ b/core/trino-main/src/main/java/io/trino/testing/PlanTester.java @@ -504,7 +504,7 @@ private PlanTester(Session defaultSession, int nodeCountForStats) defaultSession.getPreparedStatements(), defaultSession.getProtocolHeaders(), defaultSession.getExchangeEncryptionKey(), - defaultSession.getQueryDataEncodingId()); + defaultSession.getQueryDataEncoding()); } private static SessionPropertyManager createSessionPropertyManager( diff --git a/core/trino-main/src/test/java/io/trino/server/protocol/TestQueryDataSerialization.java b/core/trino-main/src/test/java/io/trino/server/protocol/TestQueryDataSerialization.java index 2456ac220167..82ec7ff11e4e 100644 --- a/core/trino-main/src/test/java/io/trino/server/protocol/TestQueryDataSerialization.java +++ b/core/trino-main/src/test/java/io/trino/server/protocol/TestQueryDataSerialization.java @@ -93,7 +93,7 @@ public void testEncodedQueryDataSerialization() EncodedQueryData queryData = new EncodedQueryData("json", ImmutableMap.of(), ImmutableList.of(Segment.inlined("[[10], [20]]".getBytes(UTF_8), dataAttributes(10, 2, 12)))); testRoundTrip(COLUMNS_LIST, queryData, """ { - "encodingId": "json", + "encoding": "json", "segments": [ { "type": "inline", @@ -114,7 +114,7 @@ public void testEncodedQueryDataSerializationWithExtraMetadata() EncodedQueryData queryData = new EncodedQueryData("json", ImmutableMap.of("decryptionKey", "secret"), ImmutableList.of(Segment.inlined("[[10], [20]]".getBytes(UTF_8), dataAttributes(10, 2, 12)))); testRoundTrip(COLUMNS_LIST, queryData, """ { - "encodingId": "json", + "encoding": "json", "metadata": { "decryptionKey": "secret" }, @@ -145,7 +145,7 @@ public void testSpooledQueryDataSerialization() .build(); testSerializationRoundTrip(queryData, """ { - "encodingId": "json", + "encoding": "json", "metadata": { "schema": "serializedSchema" }, @@ -187,10 +187,10 @@ public void testSpooledQueryDataSerialization() public void testEncodedQueryDataToString() { EncodedQueryData inlineQueryData = new EncodedQueryData("json", ImmutableMap.of("decryption_key", "secret"), ImmutableList.of(Segment.inlined("[[10], [20]]".getBytes(UTF_8), dataAttributes(10, 2, 12)))); - assertThat(inlineQueryData.toString()).isEqualTo("EncodedQueryData{encodingId=json, segments=[InlineSegment{offset=10, rows=2, size=12}], metadata=[decryption_key]}"); + assertThat(inlineQueryData.toString()).isEqualTo("EncodedQueryData{encoding=json, segments=[InlineSegment{offset=10, rows=2, size=12}], metadata=[decryption_key]}"); EncodedQueryData spooledQueryData = new EncodedQueryData("json+zstd", ImmutableMap.of("decryption_key", "secret"), ImmutableList.of(Segment.spooled(URI.create("http://coordinator:8080/v1/segments/uuid"), dataAttributes(10, 2, 1256), headers()))); - assertThat(spooledQueryData.toString()).isEqualTo("EncodedQueryData{encodingId=json+zstd, segments=[SpooledSegment{offset=10, rows=2, size=1256, headers=[x-amz-server-side-encryption]}], metadata=[decryption_key]}"); + assertThat(spooledQueryData.toString()).isEqualTo("EncodedQueryData{encoding=json+zstd, segments=[SpooledSegment{offset=10, rows=2, size=1256, headers=[x-amz-server-side-encryption]}], metadata=[decryption_key]}"); } private void testRoundTrip(List columns, QueryData queryData, String expectedDataRepresentation) diff --git a/core/trino-spi/pom.xml b/core/trino-spi/pom.xml index 2ce9eb2501d3..23af5087a474 100644 --- a/core/trino-spi/pom.xml +++ b/core/trino-spi/pom.xml @@ -677,6 +677,12 @@ method void io.trino.spi.protocol.SpoolingContext::<init>(java.lang.String, io.trino.spi.QueryId, long, long) Spooling tracing + + true + java.method.addedToInterface + method java.lang.String io.trino.spi.protocol.SpooledSegmentHandle::encoding() + Spooling encodingId renamed to encoding across the whole codebase + diff --git a/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryMetadata.java b/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryMetadata.java index 854021215e5e..dedc3566b38a 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryMetadata.java +++ b/core/trino-spi/src/main/java/io/trino/spi/eventlistener/QueryMetadata.java @@ -31,7 +31,7 @@ public class QueryMetadata { private final String queryId; private final Optional transactionId; - private final Optional encodingId; + private final Optional encoding; private final String query; private final Optional updateType; @@ -53,7 +53,7 @@ public class QueryMetadata public QueryMetadata( String queryId, Optional transactionId, - Optional encodingId, + Optional encoding, String query, Optional updateType, Optional preparedQuery, @@ -68,7 +68,7 @@ public QueryMetadata( this( queryId, transactionId, - encodingId, + encoding, query, updateType, preparedQuery, @@ -84,7 +84,7 @@ public QueryMetadata( public QueryMetadata( String queryId, Optional transactionId, - Optional encodingId, + Optional encoding, String query, Optional updateType, Optional preparedQuery, @@ -98,7 +98,7 @@ public QueryMetadata( { this.queryId = requireNonNull(queryId, "queryId is null"); this.transactionId = requireNonNull(transactionId, "transactionId is null"); - this.encodingId = requireNonNull(encodingId, "encodingId is null"); + this.encoding = requireNonNull(encoding, "encoding is null"); this.query = requireNonNull(query, "query is null"); this.updateType = requireNonNull(updateType, "updateType is null"); this.preparedQuery = requireNonNull(preparedQuery, "preparedQuery is null"); @@ -124,9 +124,9 @@ public Optional getTransactionId() } @JsonProperty - public Optional getEncodingId() + public Optional getEncoding() { - return encodingId; + return encoding; } @JsonProperty diff --git a/core/trino-spi/src/main/java/io/trino/spi/protocol/SpooledSegmentHandle.java b/core/trino-spi/src/main/java/io/trino/spi/protocol/SpooledSegmentHandle.java index 721d55395c71..fe8a4d7f1ebd 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/protocol/SpooledSegmentHandle.java +++ b/core/trino-spi/src/main/java/io/trino/spi/protocol/SpooledSegmentHandle.java @@ -26,7 +26,7 @@ public interface SpooledSegmentHandle String identifier(); - String encodingId(); + String encoding(); Instant expirationTime(); } diff --git a/core/trino-spi/src/main/java/io/trino/spi/protocol/SpoolingContext.java b/core/trino-spi/src/main/java/io/trino/spi/protocol/SpoolingContext.java index a31dd0e14580..394473a303f6 100644 --- a/core/trino-spi/src/main/java/io/trino/spi/protocol/SpoolingContext.java +++ b/core/trino-spi/src/main/java/io/trino/spi/protocol/SpoolingContext.java @@ -17,12 +17,12 @@ import static java.util.Objects.requireNonNull; -public record SpoolingContext(String encodingId, QueryId queryId, long rowCount, long size) +public record SpoolingContext(String encoding, QueryId queryId, long rowCount, long size) { public SpoolingContext { requireNonNull(queryId, "queryId is null"); - requireNonNull(encodingId, "encodingId is null"); + requireNonNull(encoding, "encoding is null"); if (rowCount < 0) { throw new IllegalArgumentException("rowCount is negative"); } diff --git a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx index 6665c080cc50..3a5e624a0a49 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx +++ b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryDetail.jsx @@ -1392,8 +1392,8 @@ export class QueryDetail extends React.Component { Protocol Encoding - {query.session.queryDataEncodingId - ? 'spooled ' + query.session.queryDataEncodingId + {query.session.queryDataEncoding + ? 'spooled ' + query.session.queryDataEncoding : 'non-spooled'} diff --git a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx index 3931a90980c1..131e467f3a52 100644 --- a/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx +++ b/core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx @@ -217,9 +217,7 @@ export class QueryListItem extends React.Component {    - {query.queryDataEncodingId - ? 'spooled ' + query.queryDataEncodingId - : 'non-spooled'} + {query.queryDataEncoding ? 'spooled ' + query.queryDataEncoding : 'non-spooled'} diff --git a/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java b/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java index 504efb6771ba..341067381ff1 100644 --- a/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java +++ b/plugin/trino-mysql-event-listener/src/test/java/io/trino/plugin/eventlistener/mysql/TestMysqlEventListener.java @@ -71,7 +71,7 @@ final class TestMysqlEventListener private static final QueryMetadata FULL_QUERY_METADATA = new QueryMetadata( "full_query", Optional.of("transactionId"), - Optional.of("encodingId"), + Optional.of("encoding"), "query", Optional.of("updateType"), Optional.of("preparedQuery"), diff --git a/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpooledSegmentHandle.java b/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpooledSegmentHandle.java index c9f555b949fe..83e0651ae238 100644 --- a/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpooledSegmentHandle.java +++ b/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpooledSegmentHandle.java @@ -28,7 +28,7 @@ import static com.google.common.base.Verify.verify; import static java.util.Objects.requireNonNull; -public record FileSystemSpooledSegmentHandle(@Override String encodingId, @Override QueryId queryId, byte[] uuid, Optional encryptionKey) +public record FileSystemSpooledSegmentHandle(@Override String encoding, @Override QueryId queryId, byte[] uuid, Optional encryptionKey) implements SpooledSegmentHandle { private static final String OBJECT_NAME_SEPARATOR = "::"; @@ -48,7 +48,7 @@ public static FileSystemSpooledSegmentHandle random(Random random, SpoolingConte public static FileSystemSpooledSegmentHandle random(Random random, SpoolingContext context, Instant expireAt, Optional encryptionKey) { return new FileSystemSpooledSegmentHandle( - context.encodingId(), + context.encoding(), context.queryId(), ULID.generateBinary(expireAt.toEpochMilli(), entropy(random)), encryptionKey); @@ -77,7 +77,7 @@ public String storageObjectName() @Override public String identifier() { - return ULID.fromBinary(uuid) + OBJECT_NAME_SEPARATOR + queryId + "." + encodingId; + return ULID.fromBinary(uuid) + OBJECT_NAME_SEPARATOR + queryId + "." + encoding; } public static Optional getExpirationFromLocation(Location location) @@ -108,7 +108,7 @@ public String toString() { return toStringHelper(this) .add("queryId", queryId) - .add("encodingId", encodingId) + .add("encoding", encoding) .add("expires", Instant.ofEpochMilli(ULID.getTimestampBinary(uuid))) .add("identifier", identifier()) .add("encryptionKey", encryptionKey.map(_ -> "[redacted]").orElse("[none")) diff --git a/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpoolingManager.java b/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpoolingManager.java index 802de0f8aea2..d2b4c3e48ea3 100644 --- a/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpoolingManager.java +++ b/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/FileSystemSpoolingManager.java @@ -161,9 +161,9 @@ public SpooledLocation location(SpooledSegmentHandle handle) DynamicSliceOutput output = new DynamicSliceOutput(64); output.writeBytes(fileHandle.uuid()); output.writeShort(fileHandle.queryId().toString().length()); - output.writeShort(fileHandle.encodingId().length()); + output.writeShort(fileHandle.encoding().length()); output.writeBytes(fileHandle.queryId().toString().getBytes(UTF_8)); - output.writeBytes(fileHandle.encodingId().getBytes(UTF_8)); + output.writeBytes(fileHandle.encoding().getBytes(UTF_8)); output.writeBoolean(fileHandle.encryptionKey().isPresent()); return coordinatorLocation(output.slice(), headers(fileHandle)); } @@ -182,14 +182,14 @@ public SpooledSegmentHandle handle(SpooledLocation location) short encodingLength = input.readShort(); QueryId queryId = QueryId.valueOf(input.readSlice(queryLength).toStringUtf8()); - String encodingId = input.readSlice(encodingLength).toStringUtf8(); + String encoding = input.readSlice(encodingLength).toStringUtf8(); if (!input.readBoolean()) { - return new FileSystemSpooledSegmentHandle(encodingId, queryId, uuid, Optional.empty()); + return new FileSystemSpooledSegmentHandle(encoding, queryId, uuid, Optional.empty()); } Slice key = getEncryptionKey(location.headers()); - return new FileSystemSpooledSegmentHandle(encodingId, queryId, uuid, Optional.of(key)); + return new FileSystemSpooledSegmentHandle(encoding, queryId, uuid, Optional.of(key)); } private static Slice getEncryptionKey(Map> headers) diff --git a/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/TracingSpoolingManager.java b/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/TracingSpoolingManager.java index ab184c103237..1ff7557c6f3f 100644 --- a/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/TracingSpoolingManager.java +++ b/plugin/trino-spooling-filesystem/src/main/java/io/trino/spooling/filesystem/TracingSpoolingManager.java @@ -36,9 +36,9 @@ public class TracingSpoolingManager implements SpoolingManager { - public static final AttributeKey SEGMENT_ID = stringKey("trino.spooled.segmentId"); - public static final AttributeKey SEGMENT_QUERY_ID = stringKey("trino.spooled.queryId"); - public static final AttributeKey SEGMENT_ENCODING_ID = stringKey("trino.spooled.encoding"); + public static final AttributeKey SEGMENT_ID = stringKey("trino.segment.id"); + public static final AttributeKey SEGMENT_QUERY_ID = stringKey("trino.segment.query_id"); + public static final AttributeKey SEGMENT_ENCODING = stringKey("trino.segment.encoding"); private final Tracer tracer; private final SpoolingManager delegate; @@ -54,7 +54,7 @@ public SpooledSegmentHandle create(SpoolingContext context) { Span span = tracer.spanBuilder("SpoolingManager.create") .setAttribute(SEGMENT_QUERY_ID, context.queryId().toString()) - .setAttribute(SEGMENT_ENCODING_ID, context.encodingId()) + .setAttribute(SEGMENT_ENCODING, context.encoding()) .startSpan(); return withTracing(span, () -> delegate.create(context)); } @@ -66,7 +66,7 @@ public OutputStream createOutputStream(SpooledSegmentHandle handle) Span span = tracer.spanBuilder("SpoolingManager.createOutputStream") .setAttribute(SEGMENT_QUERY_ID, handle.queryId().toString()) .setAttribute(SEGMENT_ID, handle.identifier()) - .setAttribute(SEGMENT_ENCODING_ID, handle.encodingId()) + .setAttribute(SEGMENT_ENCODING, handle.encoding()) .startSpan(); return withTracing(span, () -> delegate.createOutputStream(handle)); } @@ -78,7 +78,7 @@ public InputStream openInputStream(SpooledSegmentHandle handle) Span span = tracer.spanBuilder("SpoolingManager.openInputStream") .setAttribute(SEGMENT_QUERY_ID, handle.queryId().toString()) .setAttribute(SEGMENT_ID, handle.identifier()) - .setAttribute(SEGMENT_ENCODING_ID, handle.encodingId()) + .setAttribute(SEGMENT_ENCODING, handle.encoding()) .startSpan(); return withTracing(span, () -> delegate.openInputStream(handle)); } @@ -90,7 +90,7 @@ public void acknowledge(SpooledSegmentHandle handle) Span span = tracer.spanBuilder("SpoolingManager.acknowledge") .setAttribute(SEGMENT_QUERY_ID, handle.queryId().toString()) .setAttribute(SEGMENT_ID, handle.identifier()) - .setAttribute(SEGMENT_ENCODING_ID, handle.encodingId()) + .setAttribute(SEGMENT_ENCODING, handle.encoding()) .startSpan(); withTracing(span, () -> delegate.acknowledge(handle)); } @@ -102,7 +102,7 @@ public Optional directLocation(SpooledSegmentHandle handle) Span span = tracer.spanBuilder("SpoolingManager.directLocation") .setAttribute(SEGMENT_QUERY_ID, handle.queryId().toString()) .setAttribute(SEGMENT_ID, handle.identifier()) - .setAttribute(SEGMENT_ENCODING_ID, handle.encodingId()) + .setAttribute(SEGMENT_ENCODING, handle.encoding()) .startSpan(); return withTracing(span, () -> delegate.directLocation(handle)); } diff --git a/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSegmentPruner.java b/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSegmentPruner.java index 665bcdaca0e2..ee755d3a2f68 100644 --- a/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSegmentPruner.java +++ b/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSegmentPruner.java @@ -150,7 +150,7 @@ private TrinoFileSystemFactory getFileSystemFactory() private Location writeNewDummySegment(TrinoFileSystemFactory fileSystemFactory, QueryId queryId, Instant ttl) { - SpoolingContext context = new SpoolingContext("encodingId", queryId, 100, 1000); + SpoolingContext context = new SpoolingContext("encoding", queryId, 100, 1000); FileSystemSpooledSegmentHandle handle = FileSystemSpooledSegmentHandle.random(ThreadLocalRandom.current(), context, ttl); try (OutputStream segment = createFileSystem(fileSystemFactory).newOutputFile(LOCATION.appendPath(handle.storageObjectName())).create()) { segment.write("dummy".getBytes(UTF_8)); diff --git a/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSpooledSegmentHandle.java b/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSpooledSegmentHandle.java index 9bfca7b99c80..b4ae0dfa3cf6 100644 --- a/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSpooledSegmentHandle.java +++ b/plugin/trino-spooling-filesystem/src/test/java/io/trino/spooling/filesystem/TestFileSystemSpooledSegmentHandle.java @@ -28,7 +28,7 @@ class TestFileSystemSpooledSegmentHandle { private static final SecureRandom random = new SecureRandom(); private static final QueryId queryId = new QueryId("query_id"); - private static final SpoolingContext context = new SpoolingContext("encodingId", queryId, 100, 1000); + private static final SpoolingContext context = new SpoolingContext("encoding", queryId, 100, 1000); private final Instant now = Instant.now() .truncatedTo(MILLIS); // ULID retains millisecond precision diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/multinode-postgresql-spooling/tempto-configuration.yaml b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/multinode-postgresql-spooling/tempto-configuration.yaml index dc2c3477b833..6cc76b87e4da 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/multinode-postgresql-spooling/tempto-configuration.yaml +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/multinode-postgresql-spooling/tempto-configuration.yaml @@ -1,3 +1,3 @@ databases: presto: - jdbc_url: jdbc:trino://${databases.presto.host}:${databases.presto.port}/hive/${databases.hive.schema}?encodingId=json + jdbc_url: jdbc:trino://${databases.presto.host}:${databases.presto.port}/hive/${databases.hive.schema}?encoding=json diff --git a/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestEngineOnlyQueries.java b/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestEngineOnlyQueries.java index fdd89a701256..64bc7ed8c17d 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestEngineOnlyQueries.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/AbstractTestEngineOnlyQueries.java @@ -5375,7 +5375,7 @@ public void testShowSession() getSession().getPreparedStatements(), getSession().getProtocolHeaders(), getSession().getExchangeEncryptionKey(), - getSession().getQueryDataEncodingId()); + getSession().getQueryDataEncoding()); MaterializedResult result = computeActual(session, "SHOW SESSION"); ImmutableMap properties = Maps.uniqueIndex(result.getMaterializedRows(), input -> { diff --git a/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java b/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java index aa3bb62d2887..6235b56eb0b5 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/DistributedQueryRunner.java @@ -716,7 +716,7 @@ public static class Builder> private List eventListeners = ImmutableList.of(); private ImmutableList.Builder extraCloseables = ImmutableList.builder(); private TestingTrinoClientFactory testingTrinoClientFactory = TestingTrinoClient::new; - private Optional encodingId = Optional.empty(); + private Optional encoding = Optional.empty(); protected Builder(Session defaultSession) { @@ -891,9 +891,9 @@ public SELF withTracing() return self(); } - public SELF withProtocolSpooling(String encodingId) + public SELF withProtocolSpooling(String encoding) { - this.encodingId = Optional.of(encodingId); + this.encoding = Optional.of(encoding); return self(); } @@ -906,8 +906,8 @@ protected SELF self() public DistributedQueryRunner build() throws Exception { - if (encodingId.isPresent()) { - setTestingTrinoClientFactory((server, session) -> createClient(server, session, encodingId.get())); + if (encoding.isPresent()) { + setTestingTrinoClientFactory((server, session) -> createClient(server, session, encoding.get())); addExtraProperty("experimental.protocol.spooling.enabled", "true"); // create smaller number of segments addExtraProperty("protocol.spooling.initial-segment-size", "16MB"); @@ -992,7 +992,7 @@ public interface TestingTrinoClientFactory TestingTrinoClient create(TestingTrinoServer server, Session session); } - private static TestingTrinoClient createClient(TestingTrinoServer testingTrinoServer, Session session, String encodingId) + private static TestingTrinoClient createClient(TestingTrinoServer testingTrinoServer, Session session, String encoding) { return new TestingTrinoClient(testingTrinoServer, new TestingStatementClientFactory() { @Override @@ -1000,7 +1000,7 @@ public StatementClient create(OkHttpClient httpClient, Session session, ClientSe { ClientSession clientSessionSpooled = ClientSession .builder(clientSession) - .encodingId(Optional.ofNullable(encodingId)) + .encoding(Optional.ofNullable(encoding)) .build(); return newStatementClient(httpClient, clientSessionSpooled, query, Optional.empty()); } diff --git a/testing/trino-testing/src/main/java/io/trino/testing/LocalSpoolingManager.java b/testing/trino-testing/src/main/java/io/trino/testing/LocalSpoolingManager.java index 73b3613c7720..1e7795355c4e 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/LocalSpoolingManager.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/LocalSpoolingManager.java @@ -67,9 +67,9 @@ public LocalSpoolingManager() public SpooledSegmentHandle create(SpoolingContext context) { return new LocalSpooledSegmentHandle( - context.encodingId(), + context.encoding(), context.queryId(), - rootPath.resolve(context.queryId().getId() + "-" + segmentId.incrementAndGet() + "-" + UUID.randomUUID() + "." + context.encodingId())); + rootPath.resolve(context.queryId().getId() + "-" + segmentId.incrementAndGet() + "-" + UUID.randomUUID() + "." + context.encoding())); } @Override @@ -167,12 +167,12 @@ public SpoolingManager create(Map config, SpoolingManagerContext } } - public record LocalSpooledSegmentHandle(@Override String encodingId, @Override QueryId queryId, Path path) + public record LocalSpooledSegmentHandle(@Override String encoding, @Override QueryId queryId, Path path) implements SpooledSegmentHandle { public LocalSpooledSegmentHandle { - requireNonNull(encodingId, "encodingId is null"); + requireNonNull(encoding, "encoding is null"); requireNonNull(queryId, "queryId is null"); requireNonNull(path, "path is null"); } diff --git a/testing/trino-tests/src/test/java/io/trino/server/protocol/AbstractSpooledQueryDataDistributedQueries.java b/testing/trino-tests/src/test/java/io/trino/server/protocol/AbstractSpooledQueryDataDistributedQueries.java index d7d3d710f3f3..e9995f520ea9 100644 --- a/testing/trino-tests/src/test/java/io/trino/server/protocol/AbstractSpooledQueryDataDistributedQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/server/protocol/AbstractSpooledQueryDataDistributedQueries.java @@ -48,7 +48,7 @@ public abstract class AbstractSpooledQueryDataDistributedQueries { private Minio minio; - protected abstract String encodingId(); + protected abstract String encoding(); protected Map spoolingConfig() { @@ -67,7 +67,7 @@ protected QueryRunner createQueryRunner() DistributedQueryRunner queryRunner = MemoryQueryRunner.builder() .setInitialTables(TpchTable.getTables()) - .setTestingTrinoClientFactory((trinoServer, session) -> createClient(trinoServer, session, encodingId())) + .setTestingTrinoClientFactory((trinoServer, session) -> createClient(trinoServer, session, encoding())) .addExtraProperty("experimental.protocol.spooling.enabled", "true") .addExtraProperty("protocol.spooling.shared-secret-key", randomAES256Key()) .setAdditionalSetup(runner -> { @@ -100,7 +100,7 @@ protected QueryRunner createQueryRunner() return queryRunner; } - private static TestingTrinoClient createClient(TestingTrinoServer testingTrinoServer, Session session, String encodingId) + private static TestingTrinoClient createClient(TestingTrinoServer testingTrinoServer, Session session, String encoding) { return new TestingTrinoClient(testingTrinoServer, new TestingStatementClientFactory() { @Override @@ -108,7 +108,7 @@ public StatementClient create(OkHttpClient httpClient, Session session, ClientSe { ClientSession clientSessionSpooled = ClientSession .builder(clientSession) - .encodingId(Optional.ofNullable(encodingId)) + .encoding(Optional.ofNullable(encoding)) .build(); return newStatementClient(httpClient, clientSessionSpooled, query, Optional.empty()); } diff --git a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonLz4SpooledDistributedQueries.java b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonLz4SpooledDistributedQueries.java index 236c6cea135d..2e4e2a2fc5cd 100644 --- a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonLz4SpooledDistributedQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonLz4SpooledDistributedQueries.java @@ -17,7 +17,7 @@ public class TestJsonLz4SpooledDistributedQueries extends AbstractSpooledQueryDataDistributedQueries { @Override - protected String encodingId() + protected String encoding() { return "json+lz4"; } diff --git a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledDistributedQueries.java b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledDistributedQueries.java index 8a8910063198..38d768aa11b0 100644 --- a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledDistributedQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledDistributedQueries.java @@ -17,7 +17,7 @@ public class TestJsonSpooledDistributedQueries extends AbstractSpooledQueryDataDistributedQueries { @Override - protected String encodingId() + protected String encoding() { return "json"; } diff --git a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledUnencryptedDistributedQueries.java b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledUnencryptedDistributedQueries.java index 1ee5cfe2b75d..65180ca969c4 100644 --- a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledUnencryptedDistributedQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonSpooledUnencryptedDistributedQueries.java @@ -19,7 +19,7 @@ public class TestJsonSpooledUnencryptedDistributedQueries extends AbstractSpooledQueryDataDistributedQueries { @Override - protected String encodingId() + protected String encoding() { return "json+zstd"; } diff --git a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonZstdSpooledDistributedQueries.java b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonZstdSpooledDistributedQueries.java index c681b17ed673..f07899924d01 100644 --- a/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonZstdSpooledDistributedQueries.java +++ b/testing/trino-tests/src/test/java/io/trino/server/protocol/TestJsonZstdSpooledDistributedQueries.java @@ -17,7 +17,7 @@ public class TestJsonZstdSpooledDistributedQueries extends AbstractSpooledQueryDataDistributedQueries { @Override - protected String encodingId() + protected String encoding() { return "json+zstd"; }