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

stevel pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hadoop-api-shim.git

commit 7c1f5d532c6a60ebde6d71b5afc1023d841bacd1
Author: Steve Loughran <ste...@cloudera.com>
AuthorDate: Mon Jul 31 16:19:49 2023 +0100

    PARQUET-2171. Vector IO -issues addressed there pulled in here.
---
 .../java/org/apache/hadoop/fs/shim/api/VectorFileRange.java  |  8 ++++++++
 .../hadoop/fs/shim/impl/FSDataInputStreamShimImpl.java       |  8 ++++----
 .../java/org/apache/hadoop/fs/shim/impl/FileRangeBridge.java | 12 ++++++------
 .../org/apache/hadoop/fs/shim/impl/FileSystemShimImpl.java   |  2 +-
 .../org/apache/hadoop/fs/shim/impl/VectorFileRangeImpl.java  |  5 +++++
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/api/VectorFileRange.java
 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/api/VectorFileRange.java
index 0bfeb0f..b8bc1af 100644
--- 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/api/VectorFileRange.java
+++ 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/api/VectorFileRange.java
@@ -74,6 +74,14 @@ public interface VectorFileRange {
   Object getReference();
 
   /**
+   * Get the wrapped instance.
+   * Return null if it is not actually wrapping anything.
+   * @return wrapped object.
+   */
+  Object getInstance();
+
+  /**
+   *
    * Factory method to create a VectorFileRange object.
    *
    * @param offset starting offset of the range.
diff --git 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FSDataInputStreamShimImpl.java
 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FSDataInputStreamShimImpl.java
index 45df066..c7b637f 100644
--- 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FSDataInputStreamShimImpl.java
+++ 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FSDataInputStreamShimImpl.java
@@ -102,14 +102,14 @@ public class FSDataInputStreamShimImpl
   public FSDataInputStreamShimImpl(
       final FSDataInputStream instance) {
     super(FSDataInputStream.class, instance);
-    byteBufferPositionedRead = loadInvocation(getClazz(), Integer.class, READ,
-        Long.class, ByteBuffer.class);
+    byteBufferPositionedRead = loadInvocation(getClazz(), int.class, READ,
+        long.class, ByteBuffer.class);
 
     boolean bbrb = instance.hasCapability(PREADBYTEBUFFER)
         && byteBufferPositionedRead.available();
     if (bbrb) {
       byteBufferPositionedReadFully = loadInvocation(getClazz(),
-          Void.class, READ_FULLY, Long.class, ByteBuffer.class);
+          void.class, READ_FULLY, long.class, ByteBuffer.class);
       isByteBufferPositionedReadAvailable = new AtomicBoolean(true);
     } else {
       byteBufferPositionedReadFully = unavailable(READ_FULLY);
@@ -120,7 +120,7 @@ public class FSDataInputStreamShimImpl
     isByteBufferReadableAvailable = new AtomicBoolean(
         instance.getWrappedStream() instanceof ByteBufferReadable);
     if (FILE_RANGE_BRIDGE.bridgeAvailable()) {
-      readVectored = loadInvocation(getClazz(), Void.class, READ_VECTORED,
+      readVectored = loadInvocation(getClazz(), void.class, READ_VECTORED,
           List.class, IntFunction.class);
     } else {
       readVectored = unavailable(READ_VECTORED);
diff --git 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileRangeBridge.java
 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileRangeBridge.java
index 04c118b..912c63c 100644
--- 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileRangeBridge.java
+++ 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileRangeBridge.java
@@ -72,15 +72,15 @@ public final class FileRangeBridge {
     }
     fileRangeInterface = cl;
     // class found, so load the methods
-    _getOffset = loadInvocation(fileRangeInterface, Long.class, "getOffset");
-    _getLength = loadInvocation(fileRangeInterface, Integer.class, 
"getLength");
+    _getOffset = loadInvocation(fileRangeInterface, long.class, "getOffset");
+    _getLength = loadInvocation(fileRangeInterface, int.class, "getLength");
     _getData = loadInvocation(fileRangeInterface, null, "getData");
-    _setData = loadInvocation(fileRangeInterface, Void.class, "setData", 
CompletableFuture.class);
+    _setData = loadInvocation(fileRangeInterface, void.class, "setData", 
CompletableFuture.class);
     _getReference = loadInvocation(fileRangeInterface, Object.class, 
"getReference");
 
     // static interface method to create an instance.
-    createFileRange = loadInvocation(fileRangeInterface, Object.class, 
"createFileRange", Long.class,
-        Integer.class, Object.class);
+    createFileRange = loadInvocation(fileRangeInterface, Object.class, 
"createFileRange", long.class,
+        int.class, Object.class);
 
   }
 
@@ -129,7 +129,7 @@ public final class FileRangeBridge {
   public Object toFileRange(VectorFileRange range) {
     // create a new wrapped file range, fill in and then
     // get the instance
-    final WrappedFileRange wfr = createFileRange(
+    final VectorFileRange wfr = createFileRange(
         range.getOffset(), range.getLength(), range.getReference());
     return wfr.getInstance();
   }
diff --git 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileSystemShimImpl.java
 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileSystemShimImpl.java
index cab57f4..30f023f 100644
--- 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileSystemShimImpl.java
+++ 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/FileSystemShimImpl.java
@@ -118,7 +118,7 @@ public class FileSystemShimImpl extends 
AbstractAPIShim<FileSystem>
     // the simpler methods.
     Class<FileSystem> clazz = getClazz();
 
-    hasPathCapabilityMethod = loadInvocation(clazz, Boolean.class, 
"hasPathCapability",
+    hasPathCapabilityMethod = loadInvocation(clazz, boolean.class, 
"hasPathCapability",
         Path.class, String.class);
 
     msyncMethod = loadInvocation(clazz, Void.class, "msync");
diff --git 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/VectorFileRangeImpl.java
 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/VectorFileRangeImpl.java
index a6adf55..73efac0 100644
--- 
a/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/VectorFileRangeImpl.java
+++ 
b/hadoop-api-shim/src/main/java/org/apache/hadoop/fs/shim/impl/VectorFileRangeImpl.java
@@ -89,4 +89,9 @@ public class VectorFileRangeImpl implements VectorFileRange {
   public Object getReference() {
     return reference;
   }
+
+  @Override
+  public Object getInstance() {
+    return null;
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to