QuakeWang commented on code in PR #897:
URL: https://github.com/apache/paimon-rust/pull/897#discussion_r4111302321


##########
crates/paimon/src/arrow/format/blob.rs:
##########
@@ -1652,12 +1661,36 @@ struct BlobArrayLayout {
     element_index_range: Range<u64>,
 }
 
-#[derive(Debug, Clone)]
+#[derive(Debug)]
 struct BlobFileIndex {
     entries: Vec<BlobEntry>,
 }
 
 impl BlobFileIndex {
+    async fn load_cached(
+        reader: &dyn FileRead,
+        file_size: u64,
+        file_path: &str,
+    ) -> crate::Result<Arc<Self>> {
+        if !file_path.is_empty() {
+            let mut cache = BLOB_INDEX_CACHE
+                .lock()
+                .unwrap_or_else(|error| error.into_inner());
+            if let Some(index) = cache.get(file_path) {
+                return Ok(index.clone());

Review Comment:
   The same path can refer to different files when two `FileIO` instances use 
different storage roots. I tested this with two BLOB files of the same size and 
row count: opening the second reused the first file’s index and returned `NULL` 
instead of its actual value. The cache key needs to distinguish the storage 
namespace too.



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