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
5 changes: 5 additions & 0 deletions parquet-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
<artifactId>avro</artifactId>
<version>${avro.version}</version>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>${zstd-jni.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public static CodecFactory avroCodec(String codec) {
return CodecFactory.snappyCodec();
case GZIP:
return CodecFactory.deflateCodec(9);
case ZSTD:
return CodecFactory.zstandardCodec(CodecFactory.DEFAULT_ZSTANDARD_LEVEL);
default:
throw new IllegalArgumentException(
"Codec incompatible with Avro: " + codec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@
public class AvroFileTest extends ParquetFileTest {

protected File toAvro(File parquetFile) throws IOException {
return toAvro(parquetFile, "GZIP");
}

protected File toAvro(File parquetFile, String compressionCodecName) throws IOException {
ToAvroCommand command = new ToAvroCommand(createLogger());
command.targets = Arrays.asList(parquetFile.getAbsolutePath());
File output = new File(getTempFolder(), getClass().getSimpleName() + ".avro");
command.outputPath = output.getAbsolutePath();
command.compressionCodecName = compressionCodecName;
command.setConf(new Configuration());
int exitCode = command.run();
assert(exitCode == 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,27 @@ public void testToAvroCommand() throws IOException {
File avroFile = toAvro(parquetFile());
Assert.assertTrue(avroFile.exists());
}

@Test
public void testToAvroCommandWithGzipCompression() throws IOException {
File avroFile = toAvro(parquetFile(), "GZIP");
Assert.assertTrue(avroFile.exists());
}

@Test
public void testToAvroCommandWithSnappyCompression() throws IOException {
File avroFile = toAvro(parquetFile(), "SNAPPY");
Assert.assertTrue(avroFile.exists());
}

@Test
public void testToAvroCommandWithZstdCompression() throws IOException {
File avroFile = toAvro(parquetFile(), "ZSTD");
Assert.assertTrue(avroFile.exists());
}

@Test(expected = IllegalArgumentException.class)
public void testToAvroCommandWithInvalidCompression() throws IOException {
toAvro(parquetFile(), "FOO");
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
<!-- parquet-cli dependencies -->
<opencsv.version>2.3</opencsv.version>
<jcommander.version>1.35</jcommander.version>
<zstd-jni.version>1.3.8-6</zstd-jni.version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe set this to 1.4.0-1 right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment @Fokko! Avro 1.9.0 seems to depend on zstd-jni 1.3.8-6, so I reconciled them. Should I update it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, maybe leave it as is for now to avoid conflicts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

</properties>

<modules>
Expand Down