yihua commented on code in PR #13166:
URL: https://github.com/apache/hudi/pull/13166#discussion_r2052083564


##########
hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileReaderImpl.java:
##########
@@ -299,4 +301,74 @@ private boolean isAtFirstKey() {
     }
     return false;
   }
+
+  /**
+   * Read single-level or multiple-level data block index, and load all data 
block
+   * information into memory in BFS fashion.
+   *
+   * @param rootBlockReader a {@link HFileBlockReader} used to read root data 
index block;
+   *                        this reader will be used to read subsequent meta 
index block
+   *                        afterward
+   * @param numEntries      the number of entries in the root index block
+   * @param levels          the level of the indexes
+   * @return
+   */
+  private TreeMap<Key, BlockIndexEntry> readDataBlockIndex(HFileBlockReader 
rootBlockReader,
+                                                           int numEntries,
+                                                           int levels) throws 
IOException {
+    // Parse root data index block
+    HFileRootIndexBlock rootDataIndexBlock =
+        (HFileRootIndexBlock) 
rootBlockReader.nextBlock(HFileBlockType.ROOT_INDEX);
+    if (levels == 1) {

Review Comment:
   The levels is always greater than 0, including the case of an empty HFile 
(there is a test case on that where the levels of data block index is still 1). 
 A validation is added at the beginning of the method.



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