[HUDI-4192] HoodieHFileReader scan top cells after bottom cells throw NullPointerException (#5755)
SeekTo top cells avoid NullPointerException
This commit is contained in:
@@ -258,6 +258,12 @@ public class HoodieHFileReader<R extends IndexedRecord> implements HoodieFileRea
|
||||
if (!scanner.next()) {
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
} else if (val == -1) {
|
||||
// If scanner is aleady on the top of hfile. avoid trigger seekTo again.
|
||||
Option<Cell> headerCell = Option.fromJavaOptional(scanner.getReader().getFirstKey());
|
||||
if (headerCell.isPresent() && !headerCell.get().equals(scanner.getCell())) {
|
||||
scanner.seekTo();
|
||||
}
|
||||
}
|
||||
|
||||
class KeyPrefixIterator implements Iterator<GenericRecord> {
|
||||
|
||||
Reference in New Issue
Block a user