JingsongLi commented on code in PR #998:
URL: https://github.com/apache/paimon-rust/pull/998#discussion_r4172455801


##########
crates/paimon/src/arrow/format/blob.rs:
##########
@@ -1785,6 +1809,45 @@ impl BlobFileIndex {
     }
 }
 
+#[derive(Debug)]
+struct SharedBlobIndexError(Arc<Error>);
+
+impl std::fmt::Display for SharedBlobIndexError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        std::fmt::Display::fmt(self.0.as_ref(), f)
+    }
+}
+
+impl std::error::Error for SharedBlobIndexError {
+    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
+        Some(self.0.as_ref())
+    }
+}
+
+fn clone_blob_index_error(error: &Arc<Error>) -> Error {
+    let source = || {
+        Some(Box::new(SharedBlobIndexError(Arc::clone(error)))
+            as Box<dyn std::error::Error + Send + Sync>)
+    };
+    match error.as_ref() {
+        Error::DataInvalid { message, .. } => Error::DataInvalid {
+            message: message.clone(),
+            source: source(),
+        },
+        Error::Unsupported { message } => Error::Unsupported {
+            message: message.clone(),
+        },
+        Error::UnexpectedError { message, .. } => Error::UnexpectedError {
+            message: message.clone(),
+            source: source(),
+        },
+        _ => Error::UnexpectedError {

Review Comment:
   [P2] Preserve the I/O error category when sharing BLOB load failures
   
   A cold index read that exhausts storage retries returns 
`Error::IoUnexpected`, but this fallback converts it to `UnexpectedError`. 
Before this change, `load_cached` propagated the original I/O variant. This 
reaches `paimon_record_batch_reader_next`, whose C adapter maps `IoUnexpected` 
to public `IoError = 5` and `UnexpectedError` to `Unexpected = 0`; Go exposes 
those same codes. The caller therefore loses the I/O category used for 
storage-specific retry/handling. A targeted `FileRead` failure confirms 
`load()` preserves `IoUnexpected` while `load_cached()` loses it with both a 64 
MiB budget and budget 0. Keeping the cause chain fixes fork detection but does 
not fix adapters that classify the outer variant. Please preserve the storage 
error variant during sharing, or consistently recover its typed cause in the 
public error adapters, and cover the cached and disabled paths.



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