You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by wi...@apache.org on 2022/07/24 20:41:28 UTC

[orc] branch main updated: ORC-1223: Move `DirectDecompressWrapper` to `org.apache.orc.impl`

This is an automated email from the ASF dual-hosted git repository.

william 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 937b99f88 ORC-1223: Move `DirectDecompressWrapper` to `org.apache.orc.impl`
937b99f88 is described below

commit 937b99f88bd571780047fef4730775ae1d01ba21
Author: William Hyun <wi...@apache.org>
AuthorDate: Sun Jul 24 13:41:16 2022 -0700

    ORC-1223: Move `DirectDecompressWrapper` to `org.apache.orc.impl`
    
    ### What changes were proposed in this pull request?
    This PR aims to move `DirectDecompressWrapper` to `org.apache.orc.impl`
    
    ### Why are the changes needed?
    To clean up old Hadoop support
    
    ### How was this patch tested?
    Pass the CIs.
    
    Closes #1189 from williamhyun/movedecrompresswrapper.
    
    Authored-by: William Hyun <wi...@apache.org>
    Signed-off-by: William Hyun <wi...@apache.org>
---
 .../org/apache/orc/impl/HadoopShimsPre2_6.java     | 59 ----------------------
 .../orc/impl/SnappyDirectDecompressWrapper.java    | 53 +++++++++++++++++++
 .../orc/impl/ZlibDirectDecompressWrapper.java      | 53 +++++++++++++++++++
 3 files changed, 106 insertions(+), 59 deletions(-)

diff --git a/java/shims/src/java/org/apache/orc/impl/HadoopShimsPre2_6.java b/java/shims/src/java/org/apache/orc/impl/HadoopShimsPre2_6.java
index 7017aa863..fa7df7bfd 100644
--- a/java/shims/src/java/org/apache/orc/impl/HadoopShimsPre2_6.java
+++ b/java/shims/src/java/org/apache/orc/impl/HadoopShimsPre2_6.java
@@ -25,7 +25,6 @@ import org.apache.hadoop.io.compress.zlib.ZlibDecompressor;
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.ByteBuffer;
 import java.util.Random;
 
 /**
@@ -39,64 +38,6 @@ import java.util.Random;
  */
 public class HadoopShimsPre2_6 implements HadoopShims {
 
-  static class SnappyDirectDecompressWrapper implements DirectDecompressor {
-    private final SnappyDirectDecompressor root;
-    private boolean isFirstCall = true;
-
-    SnappyDirectDecompressWrapper(SnappyDirectDecompressor root) {
-      this.root = root;
-    }
-
-    @Override
-    public void decompress(ByteBuffer input, ByteBuffer output) throws IOException {
-      if (!isFirstCall) {
-        root.reset();
-      } else {
-        isFirstCall = false;
-      }
-      root.decompress(input, output);
-    }
-
-    @Override
-    public void reset() {
-      root.reset();
-    }
-
-    @Override
-    public void end() {
-      root.end();
-    }
-  }
-
-  static class ZlibDirectDecompressWrapper implements DirectDecompressor {
-    private final ZlibDecompressor.ZlibDirectDecompressor root;
-    private boolean isFirstCall = true;
-
-    ZlibDirectDecompressWrapper(ZlibDecompressor.ZlibDirectDecompressor root) {
-      this.root = root;
-    }
-
-    @Override
-    public void decompress(ByteBuffer input, ByteBuffer output) throws IOException {
-      if (!isFirstCall) {
-        root.reset();
-      } else {
-        isFirstCall = false;
-      }
-      root.decompress(input, output);
-    }
-
-    @Override
-    public void reset() {
-      root.reset();
-    }
-
-    @Override
-    public void end() {
-      root.end();
-    }
-  }
-
   static DirectDecompressor getDecompressor( DirectCompressionType codec) {
     switch (codec) {
       case ZLIB:
diff --git a/java/shims/src/java/org/apache/orc/impl/SnappyDirectDecompressWrapper.java b/java/shims/src/java/org/apache/orc/impl/SnappyDirectDecompressWrapper.java
new file mode 100644
index 000000000..8e4d32f34
--- /dev/null
+++ b/java/shims/src/java/org/apache/orc/impl/SnappyDirectDecompressWrapper.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.orc.impl;
+
+import org.apache.hadoop.io.compress.snappy.SnappyDecompressor;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+class SnappyDirectDecompressWrapper implements HadoopShims.DirectDecompressor {
+    private final SnappyDecompressor.SnappyDirectDecompressor root;
+    private boolean isFirstCall = true;
+
+    SnappyDirectDecompressWrapper(SnappyDecompressor.SnappyDirectDecompressor root) {
+        this.root = root;
+    }
+
+    @Override
+    public void decompress(ByteBuffer input, ByteBuffer output) throws IOException {
+        if (!isFirstCall) {
+            root.reset();
+        } else {
+            isFirstCall = false;
+        }
+        root.decompress(input, output);
+    }
+
+    @Override
+    public void reset() {
+        root.reset();
+    }
+
+    @Override
+    public void end() {
+        root.end();
+    }
+}
diff --git a/java/shims/src/java/org/apache/orc/impl/ZlibDirectDecompressWrapper.java b/java/shims/src/java/org/apache/orc/impl/ZlibDirectDecompressWrapper.java
new file mode 100644
index 000000000..01fe34aae
--- /dev/null
+++ b/java/shims/src/java/org/apache/orc/impl/ZlibDirectDecompressWrapper.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.orc.impl;
+
+import org.apache.hadoop.io.compress.zlib.ZlibDecompressor;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+class ZlibDirectDecompressWrapper implements HadoopShims.DirectDecompressor {
+    private final ZlibDecompressor.ZlibDirectDecompressor root;
+    private boolean isFirstCall = true;
+
+    ZlibDirectDecompressWrapper(ZlibDecompressor.ZlibDirectDecompressor root) {
+        this.root = root;
+    }
+
+    @Override
+    public void decompress(ByteBuffer input, ByteBuffer output) throws IOException {
+        if (!isFirstCall) {
+            root.reset();
+        } else {
+            isFirstCall = false;
+        }
+        root.decompress(input, output);
+    }
+
+    @Override
+    public void reset() {
+        root.reset();
+    }
+
+    @Override
+    public void end() {
+        root.end();
+    }
+}