Skip to content

Commit

Permalink
Enable LZ4 encoding for exchange compression
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Feb 10, 2025
1 parent 5a499e6 commit 8b1f35b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,23 +314,23 @@ public void testSession()
try (Connection connection = createConnection()) {
assertThat(listSession(connection))
.contains("join_distribution_type|AUTOMATIC|AUTOMATIC")
.contains("exchange_compression_codec|NONE|NONE");
.contains("exchange_compression_codec|LZ4|LZ4");

try (Statement statement = connection.createStatement()) {
statement.execute("SET SESSION join_distribution_type = 'BROADCAST'");
}

assertThat(listSession(connection))
.contains("join_distribution_type|BROADCAST|AUTOMATIC")
.contains("exchange_compression_codec|NONE|NONE");
.contains("exchange_compression_codec|LZ4|LZ4");

try (Statement statement = connection.createStatement()) {
statement.execute("SET SESSION exchange_compression_codec = 'LZ4'");
statement.execute("SET SESSION exchange_compression_codec = 'ZSTD'");
}

assertThat(listSession(connection))
.contains("join_distribution_type|BROADCAST|AUTOMATIC")
.contains("exchange_compression_codec|LZ4|NONE");
.contains("exchange_compression_codec|ZSTD|LZ4");

try (Statement statement = connection.createStatement()) {
// setting Hive session properties requires the admin role
Expand All @@ -346,7 +346,7 @@ public void testSession()

assertThat(listSession(connection))
.contains("join_distribution_type|BROADCAST|AUTOMATIC")
.contains("exchange_compression_codec|LZ4|NONE")
.contains("exchange_compression_codec|ZSTD|LZ4")
.contains(format("spatial_partitioning_table_name|%s|", value));
}
catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion core/trino-main/src/main/java/io/trino/FeaturesConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class FeaturesConfig
/**
* default value is overwritten for fault tolerant execution in {@link #applyFaultTolerantExecutionDefaults()}}
*/
private CompressionCodec exchangeCompressionCodec = NONE;
private CompressionCodec exchangeCompressionCodec = LZ4;
private boolean pagesIndexEagerCompactionEnabled;
private boolean omitDateTimeTypePrecision;
private int maxRecursionDepth = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import static io.trino.SystemSessionProperties.getRetryPolicy;
import static io.trino.execution.QueryState.FAILED;
import static io.trino.execution.QueryState.FINISHING;
import static io.trino.execution.buffer.CompressionCodec.NONE;
import static io.trino.execution.buffer.CompressionCodec.LZ4;
import static io.trino.memory.context.AggregatedMemoryContext.newSimpleAggregatedMemoryContext;
import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -94,7 +94,7 @@ public DispatchQuery execute(SessionContext sessionContext, @Language("SQL") Str
}
});

PageDeserializer pageDeserializer = new PagesSerdeFactory(blockEncodingSerde, NONE).createDeserializer(Optional.empty());
PageDeserializer pageDeserializer = new PagesSerdeFactory(blockEncodingSerde, LZ4).createDeserializer(Optional.empty());
for (QueryState state = queryManager.getQueryState(queryId);
(state != FAILED) &&
!exchangeClient.isFinished() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static io.airlift.units.DataSize.Unit.GIGABYTE;
import static io.airlift.units.DataSize.Unit.KILOBYTE;
import static io.airlift.units.DataSize.Unit.MEGABYTE;
import static io.trino.execution.buffer.CompressionCodec.NONE;
import static io.trino.execution.buffer.CompressionCodec.LZ4;
import static io.trino.execution.buffer.CompressionCodec.ZSTD;
import static io.trino.sql.analyzer.RegexLibrary.JONI;
import static io.trino.sql.analyzer.RegexLibrary.RE2J;
Expand All @@ -53,7 +53,7 @@ public void testDefaults()
.setSpillMaxUsedSpaceThreshold(0.9)
.setMemoryRevokingThreshold(0.9)
.setMemoryRevokingTarget(0.5)
.setExchangeCompressionCodec(NONE)
.setExchangeCompressionCodec(LZ4)
.setExchangeDataIntegrityVerification(DataIntegrityVerification.ABORT)
.setPagesIndexEagerCompactionEnabled(false)
.setFilterAndProjectMinOutputPageSize(DataSize.of(500, KILOBYTE))
Expand Down

0 comments on commit 8b1f35b

Please sign in to comment.