nsivabalan commented on a change in pull request #2494:
URL: https://github.com/apache/hudi/pull/2494#discussion_r567236518
##########
File path:
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieHFileReader.java
##########
@@ -209,12 +212,23 @@ public R next() {
@Override
public Option getRecordByKey(String key, Schema readerSchema) throws
IOException {
- HFileScanner scanner = reader.getScanner(false, true);
+ byte[] value = null;
KeyValue kv = new KeyValue(key.getBytes(), null, null, null);
- if (scanner.seekTo(kv) == 0) {
- Cell c = scanner.getKeyValue();
- byte[] keyBytes = Arrays.copyOfRange(c.getRowArray(), c.getRowOffset(),
c.getRowOffset() + c.getRowLength());
- R record = getRecordFromCell(c, getSchema(), readerSchema);
+
+ synchronized (this) {
+ if (keyScanner == null) {
+ keyScanner = reader.getScanner(true, true);
Review comment:
gotcha
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]