You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "danny0405 (via GitHub)" <gi...@apache.org> on 2023/06/22 09:13:02 UTC
[GitHub] [hudi] danny0405 commented on a diff in pull request #9037: [HUDI-6420][WIP] Fixing seekTo() calls with hfile readers to reseek wherever applicable
danny0405 commented on code in PR #9037:
URL: https://github.com/apache/hudi/pull/9037#discussion_r1238242029
##########
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieAvroHFileReader.java:
##########
@@ -120,20 +120,14 @@ public HoodieAvroHFileReader(Path path, HFile.Reader reader, Option<Schema> sche
.orElseGet(() -> Lazy.lazily(() -> fetchSchema(reader)));
}
- @Override
- public Option<HoodieRecord<IndexedRecord>> getRecordByKey(String key, Schema readerSchema) throws IOException {
- synchronized (sharedScannerLock) {
- return fetchRecordByKeyInternal(sharedScanner, key, getSchema(), readerSchema)
- .map(data -> unsafeCast(new HoodieAvroIndexedRecord(data)));
- }
- }
@Override
public ClosableIterator<HoodieRecord<IndexedRecord>> getRecordsByKeysIterator(List<String> keys, Schema schema) throws IOException {
// We're caching blocks for this scanner to minimize amount of traffic
// to the underlying storage as we fetched (potentially) sparsely distributed
// keys
HFileScanner scanner = getHFileScanner(reader, true);
+ scanner.seekTo(); // places the cursor at the beginning of the first data block.
ClosableIterator<IndexedRecord> iterator = new RecordByKeyIterator(scanner, keys, getSchema(), schema);
Review Comment:
Should we always invoke `scanner.seekTo` just inside `getHFileScanner`, right after we got a reader.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org