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

danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 7cf6dc1832a [HUDI-8601] By default disable native hfile reader (#13150)
7cf6dc1832a is described below

commit 7cf6dc1832a902392b31fd0f3ee03d5895b4f680
Author: Lin Liu <[email protected]>
AuthorDate: Wed Apr 16 01:38:44 2025 -0700

    [HUDI-8601] By default disable native hfile reader (#13150)
---
 .../hudi/common/config/HoodieReaderConfig.java     |  2 +-
 .../hudi/io/hadoop/HoodieHBaseAvroHFileReader.java | 41 ++++++++++++++--------
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git 
a/hudi-common/src/main/java/org/apache/hudi/common/config/HoodieReaderConfig.java
 
b/hudi-common/src/main/java/org/apache/hudi/common/config/HoodieReaderConfig.java
index 56935fc5d81..fb205d0332a 100644
--- 
a/hudi-common/src/main/java/org/apache/hudi/common/config/HoodieReaderConfig.java
+++ 
b/hudi-common/src/main/java/org/apache/hudi/common/config/HoodieReaderConfig.java
@@ -31,7 +31,7 @@ import javax.annotation.concurrent.Immutable;
 public class HoodieReaderConfig extends HoodieConfig {
   public static final ConfigProperty<Boolean> USE_NATIVE_HFILE_READER = 
ConfigProperty
       .key("_hoodie.hfile.use.native.reader")
-      .defaultValue(true)
+      .defaultValue(false)
       .markAdvanced()
       .sinceVersion("1.0.0")
       .withDocumentation("When enabled, the native HFile reader is used to 
read HFiles.  This is an internal config.");
diff --git 
a/hudi-hadoop-common/src/main/java/org/apache/hudi/io/hadoop/HoodieHBaseAvroHFileReader.java
 
b/hudi-hadoop-common/src/main/java/org/apache/hudi/io/hadoop/HoodieHBaseAvroHFileReader.java
index dfcc36d2ab1..cf7a322fbc5 100644
--- 
a/hudi-hadoop-common/src/main/java/org/apache/hudi/io/hadoop/HoodieHBaseAvroHFileReader.java
+++ 
b/hudi-hadoop-common/src/main/java/org/apache/hudi/io/hadoop/HoodieHBaseAvroHFileReader.java
@@ -338,32 +338,43 @@ public class HoodieHBaseAvroHFileReader extends 
HoodieAvroHFileReaderImplBase {
           return false;
         }
 
-        Cell c = Objects.requireNonNull(scanner.getCell());
-        byte[] keyBytes = copyKeyFromCell(c);
-        String key = new String(keyBytes);
-        // Check whether we're still reading records corresponding to the 
key-prefix
-        if (!key.startsWith(keyPrefix)) {
-          return false;
-        }
-
-        // Extract the byte value before releasing the lock since we cannot 
hold on to the returned cell afterwards
-        byte[] valueBytes = copyValueFromCell(c);
         try {
+          Cell c = scanner.getCell();
+          if (c == null) {
+            eof = true;
+            return false;
+          }
+
+          byte[] keyBytes = copyKeyFromCell(c);
+          String key = new String(keyBytes);
+
+          // Check key prefix match
+          if (!key.startsWith(keyPrefix)) {
+            eof = true;
+            return false;
+          }
+
+          // Extract value and deserialize
+          byte[] valueBytes = copyValueFromCell(c);
           next = deserialize(keyBytes, valueBytes, writerSchema, readerSchema);
-          // In case scanner is not able to advance, it means we reached EOF
+
+          // Advance for next call
           eof = !scanner.next();
+          return true;
+
         } catch (IOException e) {
           throw new HoodieIOException("Failed to deserialize payload", e);
         }
-
-        return true;
       }
 
       @Override
       public IndexedRecord next() {
-        IndexedRecord next = this.next;
+        if (!hasNext()) {
+          throw new HoodieIOException("No more elements");
+        }
+        IndexedRecord result = this.next;
         this.next = null;
-        return next;
+        return result;
       }
     }
 

Reply via email to