danny0405 commented on code in PR #19021:
URL: https://github.com/apache/hudi/pull/19021#discussion_r3425342566


##########
hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileDataBlock.java:
##########
@@ -104,39 +106,57 @@ static HFileDataBlock createDataBlockToWrite(HFileContext 
context,
   int seekTo(HFileCursor cursor, Key key, int blockStartOffsetInFile) {
     int relativeOffset = cursor.getOffset() - blockStartOffsetInFile;
     int lastRelativeOffset = relativeOffset;
+    // The key-value cached at the starting position, if any. It is only 
consulted to re-cache it
+    // in the cursor when the lookup lands "in range" on the very first 
comparison; entries scanned
+    // past are compared directly against the backing buffer below (no 
per-entry KeyValue/Key
+    // allocation), so this is emptied after the first iteration and the 
cursor falls back to a
+    // deferred read.
     Option<KeyValue> lastKeyValue = cursor.getKeyValue();
+    // The lookup key content is fixed across the scan; hoist it out of the 
loop. Note the lookup
+    // key may be a UTF8StringKey, so use the polymorphic content accessors 
(no 2-byte prefix).
+    byte[] lookupBytes = key.getBytes();
+    int lookupContentOffset = key.getContentOffset();
+    int lookupContentLength = key.getContentLength();

Review Comment:
   can we add some UTs to validate this.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to