1
0

[HUDI-4192] HoodieHFileReader scan top cells after bottom cells throw NullPointerException (#5755)

SeekTo top cells avoid NullPointerException
This commit is contained in:
marchpure
2022-06-06 12:07:26 +08:00
committed by GitHub
parent 5d18b80343
commit 73b0be3c96
2 changed files with 38 additions and 0 deletions

View File

@@ -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> {