This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new edf9d877c ORC-2077: Introduce `NullOptions` class for
`CompressionCodec`
edf9d877c is described below
commit edf9d877c0c3ebea4338696ca9c3cf7925621a3a
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Fri Feb 6 09:41:27 2026 -0800
ORC-2077: Introduce `NullOptions` class for `CompressionCodec`
### What changes were proposed in this pull request?
This PR aims to introduce `NullOptions` class for `CompressionCodec`.
### Why are the changes needed?
To reuse this class in another codec.
### How was this patch tested?
Pass the CIs.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: `Opus 4.5` on `Claude Code`
Closes #2514 from dongjoon-hyun/ORC-2077.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../src/java/org/apache/orc/CompressionCodec.java | 33 ++++++++++++++++++++++
.../org/apache/orc/impl/AircompressorCodec.java | 29 +------------------
2 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/java/core/src/java/org/apache/orc/CompressionCodec.java
b/java/core/src/java/org/apache/orc/CompressionCodec.java
index f13f3c487..c926fa0eb 100644
--- a/java/core/src/java/org/apache/orc/CompressionCodec.java
+++ b/java/core/src/java/org/apache/orc/CompressionCodec.java
@@ -62,6 +62,39 @@ public interface CompressionCodec extends Closeable {
Options setData(DataKind newValue);
}
+ /**
+ * A null implementation of Options that ignores all settings.
+ * Useful for codecs that don't support any configuration options.
+ */
+ class NullOptions implements Options {
+ public static final NullOptions INSTANCE = new NullOptions();
+
+ @Override
+ public Options copy() {
+ return this;
+ }
+
+ @Override
+ public Options setSpeed(SpeedModifier newValue) {
+ return this;
+ }
+
+ @Override
+ public Options setData(DataKind newValue) {
+ return this;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other != null && getClass() == other.getClass();
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+ }
+
/**
* Get the default options for this codec.
* @return the default options object
diff --git a/java/core/src/java/org/apache/orc/impl/AircompressorCodec.java
b/java/core/src/java/org/apache/orc/impl/AircompressorCodec.java
index 6a740bd6a..5bc281bfc 100644
--- a/java/core/src/java/org/apache/orc/impl/AircompressorCodec.java
+++ b/java/core/src/java/org/apache/orc/impl/AircompressorCodec.java
@@ -98,36 +98,9 @@ public class AircompressorCodec implements CompressionCodec {
out.flip();
}
- private static final Options NULL_OPTION = new Options() {
- @Override
- public Options copy() {
- return this;
- }
-
- @Override
- public Options setSpeed(SpeedModifier newValue) {
- return this;
- }
-
- @Override
- public Options setData(DataKind newValue) {
- return this;
- }
-
- @Override
- public boolean equals(Object other) {
- return other != null && getClass() == other.getClass();
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
- };
-
@Override
public Options getDefaultOptions() {
- return NULL_OPTION;
+ return CompressionCodec.NullOptions.INSTANCE;
}
@Override