Skip to content

Commit

Permalink
Try native (de)compression
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Jun 27, 2024
1 parent 8947d40 commit 057b5e9
Show file tree
Hide file tree
Showing 22 changed files with 178 additions and 122 deletions.
10 changes: 5 additions & 5 deletions core/trino-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@
<artifactId>failsafe</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>bootstrap</artifactId>
Expand Down Expand Up @@ -375,6 +370,11 @@
<artifactId>jmxutils</artifactId>
</dependency>

<dependency>
<groupId>pl.wendigo</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
12 changes: 6 additions & 6 deletions lib/trino-hive-formats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@
<artifactId>commons-codec</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>log</artifactId>
Expand Down Expand Up @@ -99,6 +93,12 @@
<artifactId>modernizer-maven-annotations</artifactId>
</dependency>

<dependency>
<groupId>pl.wendigo</groupId>
<artifactId>aircompressor</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package io.trino.hive.formats.compression;

import io.airlift.compress.hadoop.HadoopStreams;
import io.airlift.compressor.hadoop.HadoopStreams;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.airlift.compress.bzip2.BZip2HadoopStreams;
import io.airlift.compress.deflate.JdkDeflateHadoopStreams;
import io.airlift.compress.gzip.JdkGzipHadoopStreams;
import io.airlift.compress.hadoop.HadoopStreams;
import io.airlift.compress.lz4.Lz4HadoopStreams;
import io.airlift.compress.lzo.LzoHadoopStreams;
import io.airlift.compress.lzo.LzopHadoopStreams;
import io.airlift.compress.snappy.SnappyHadoopStreams;
import io.airlift.compress.zstd.ZstdHadoopStreams;
import io.airlift.compressor.bzip2.BZip2HadoopStreams;
import io.airlift.compressor.deflate.JdkDeflateHadoopStreams;
import io.airlift.compressor.gzip.JdkGzipHadoopStreams;
import io.airlift.compressor.hadoop.HadoopStreams;
import io.airlift.compressor.lz4.Lz4HadoopStreams;
import io.airlift.compressor.lzo.LzoHadoopStreams;
import io.airlift.compressor.lzo.LzopHadoopStreams;
import io.airlift.compressor.snappy.SnappyHadoopStreams;
import io.airlift.compressor.zstd.ZstdHadoopStreams;

import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package io.trino.hive.formats.compression;

import io.airlift.compress.hadoop.HadoopStreams;
import io.airlift.compressor.hadoop.HadoopStreams;
import io.airlift.slice.Slice;
import io.trino.plugin.base.io.ChunkedSliceOutput;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package io.trino.hive.formats.compression;

import io.airlift.compress.hadoop.HadoopStreams;
import io.airlift.compressor.hadoop.HadoopStreams;
import io.airlift.slice.DynamicSliceOutput;
import io.airlift.slice.Slice;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package io.trino.hive.formats.compression;

import io.airlift.compress.hadoop.HadoopStreams;
import io.airlift.compressor.hadoop.HadoopStreams;
import io.airlift.slice.Slice;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
package com.hadoop.compression.lzo;

public class LzopCodec
extends io.airlift.compress.lzo.LzopCodec {}
extends io.airlift.compressor.lzo.LzopCodec {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
package org.apache.hadoop.io.compress;

public class LzoCodec
extends io.airlift.compress.lzo.LzoCodec
extends io.airlift.compressor.lzo.LzoCodec
{}
16 changes: 11 additions & 5 deletions lib/trino-orc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>log</artifactId>
Expand Down Expand Up @@ -104,6 +99,11 @@
<artifactId>jmxutils</artifactId>
</dependency>

<dependency>
<groupId>pl.wendigo</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
Expand Down Expand Up @@ -156,6 +156,12 @@
<groupId>io.trino.hive</groupId>
<artifactId>hive-apache</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
10 changes: 5 additions & 5 deletions lib/trino-parquet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>log</artifactId>
Expand Down Expand Up @@ -95,6 +90,11 @@
</exclusions>
</dependency>

<dependency>
<groupId>pl.wendigo</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-spi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import io.airlift.compress.snappy.SnappyCompressor;
import io.airlift.compress.snappy.SnappyRawCompressor;
import io.airlift.slice.Slice;
import io.airlift.slice.Slices;
import io.trino.parquet.DataPage;
Expand Down Expand Up @@ -376,8 +375,9 @@ private static byte[] compress(CompressionCodec compressionCodec, byte[] bytes,
return Arrays.copyOfRange(bytes, offset, offset + length);
}
if (compressionCodec == SNAPPY) {
byte[] out = new byte[SnappyRawCompressor.maxCompressedLength(length)];
int compressedSize = new SnappyCompressor().compress(bytes, offset, length, out, 0, out.length);
SnappyCompressor compressor = new SnappyCompressor();
byte[] out = new byte[compressor.maxCompressedLength(length)];
int compressedSize = compressor.compress(bytes, offset, length, out, 0, out.length);
return Arrays.copyOf(out, compressedSize);
}
throw new IllegalArgumentException("unsupported compression code " + compressionCodec);
Expand Down
22 changes: 17 additions & 5 deletions plugin/trino-hive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@
<artifactId>failsafe</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>bootstrap</artifactId>
Expand Down Expand Up @@ -245,6 +240,11 @@
<artifactId>jmxutils</artifactId>
</dependency>

<dependency>
<groupId>pl.wendigo</groupId>
<artifactId>aircompressor</artifactId>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
Expand Down Expand Up @@ -518,6 +518,12 @@
<groupId>io.trino.hive</groupId>
<artifactId>hive-apache</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -530,6 +536,12 @@
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void testToGlueFunctionInput()
.build();
LanguageFunction actual = GlueConverter.fromGlueFunction(function);

assertThat(input.resourceUris().size()).isEqualTo(4);
assertThat(input.resourceUris().size()).isEqualTo(3);
assertThat(actual).isEqualTo(expected);

// verify that the owner comes from the metastore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void testConvertFunction()
.withResourceUris(input.getResourceUris());
LanguageFunction actual = GlueToTrinoConverter.convertFunction(function);

assertThat(input.getResourceUris().size()).isEqualTo(4);
assertThat(input.getResourceUris().size()).isEqualTo(3);
assertThat(actual).isEqualTo(expected);

// verify that the owner comes from the metastore
Expand Down
6 changes: 6 additions & 0 deletions plugin/trino-hudi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
24 changes: 24 additions & 0 deletions plugin/trino-iceberg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@
<dependency>
<groupId>org.apache.iceberg</groupId>
<artifactId>iceberg-core</artifactId>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -563,6 +569,12 @@
<groupId>io.trino.hive</groupId>
<artifactId>hive-apache</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -576,12 +588,24 @@
<artifactId>iceberg-core</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>aircompressor</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Loading

0 comments on commit 057b5e9

Please sign in to comment.