This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 42b39f146e [format] Fix ORC zstd compression option inconsistent
across writers (#9453)
42b39f146e is described below
commit 42b39f146e9809a54cdecad071b79a027dec9f10
Author: Arnav Balyan <[email protected]>
AuthorDate: Sat Aug 29 18:25:07 2026 +0530
[format] Fix ORC zstd compression option inconsistent across writers (#9453)
---
.../src/main/java/org/apache/orc/impl/PhysicalFsWriter.java | 5 ++---
paimon-format/src/main/java/org/apache/orc/impl/ZstdCodec.java | 2 +-
.../test/java/org/apache/paimon/format/orc/writer/OrcZstdTest.java | 5 +++++
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git
a/paimon-format/src/main/java/org/apache/orc/impl/PhysicalFsWriter.java
b/paimon-format/src/main/java/org/apache/orc/impl/PhysicalFsWriter.java
index 868c577bb9..51be3710c3 100644
--- a/paimon-format/src/main/java/org/apache/orc/impl/PhysicalFsWriter.java
+++ b/paimon-format/src/main/java/org/apache/orc/impl/PhysicalFsWriter.java
@@ -140,9 +140,8 @@ public class PhysicalFsWriter implements PhysicalWriter {
CompressionCodec codec = OrcCodecPool.getCodec(opts.getCompress());
if (codec != null) {
CompressionCodec.Options tempOptions = codec.getDefaultOptions();
- if (codec instanceof ZstdCodec
- && codec.getDefaultOptions() instanceof
ZstdCodec.ZstdOptions) {
- ZstdCodec.ZstdOptions options = (ZstdCodec.ZstdOptions)
codec.getDefaultOptions();
+ if (codec instanceof ZstdCodec && tempOptions instanceof
ZstdCodec.ZstdOptions) {
+ ZstdCodec.ZstdOptions options = (ZstdCodec.ZstdOptions)
tempOptions;
OrcFile.ZstdCompressOptions zstdCompressOptions =
opts.getZstdCompressOptions();
if (zstdCompressOptions != null) {
options.setLevel(zstdCompressOptions.getCompressionZstdLevel());
diff --git a/paimon-format/src/main/java/org/apache/orc/impl/ZstdCodec.java
b/paimon-format/src/main/java/org/apache/orc/impl/ZstdCodec.java
index 6803053dd2..2b362bc9a2 100644
--- a/paimon-format/src/main/java/org/apache/orc/impl/ZstdCodec.java
+++ b/paimon-format/src/main/java/org/apache/orc/impl/ZstdCodec.java
@@ -165,7 +165,7 @@ public class ZstdCodec implements CompressionCodec,
DirectDecompressionCodec {
@Override
public Options getDefaultOptions() {
- return DEFAULT_OPTIONS;
+ return DEFAULT_OPTIONS.copy();
}
/**
diff --git
a/paimon-format/src/test/java/org/apache/paimon/format/orc/writer/OrcZstdTest.java
b/paimon-format/src/test/java/org/apache/paimon/format/orc/writer/OrcZstdTest.java
index 8110998576..173cfd91dc 100644
---
a/paimon-format/src/test/java/org/apache/paimon/format/orc/writer/OrcZstdTest.java
+++
b/paimon-format/src/test/java/org/apache/paimon/format/orc/writer/OrcZstdTest.java
@@ -39,6 +39,7 @@ import org.apache.orc.CompressionCodec;
import org.apache.orc.CompressionKind;
import org.apache.orc.OrcFile;
import org.apache.orc.Reader;
+import org.apache.orc.impl.OrcCodecPool;
import org.apache.orc.impl.ZstdCodec;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -58,6 +59,9 @@ class OrcZstdTest {
@Test
void testWriteOrcWithZstd(@TempDir java.nio.file.Path tempDir) throws
IOException {
+ CompressionCodec zstdCodec =
OrcCodecPool.getCodec(CompressionKind.ZSTD);
+ int originalHashCode = zstdCodec.getDefaultOptions().hashCode();
+
Options options = new Options();
options.set("orc.compress", "zstd");
options.set("orc.stripe.size", "31457280");
@@ -90,6 +94,7 @@ class OrcZstdTest {
FormatWriter formatWriter = writerFactory.create(out, "zstd");
Assertions.assertThat(formatWriter).isInstanceOf(OrcBulkWriter.class);
+
Assertions.assertThat(zstdCodec.getDefaultOptions().hashCode()).isEqualTo(originalHashCode);
Options optionsWithLowLevel = new Options();
optionsWithLowLevel.set("orc.compress", "zstd");