mbutrovich commented on code in PR #3224:
URL: https://github.com/apache/iceberg-rust/pull/3224#discussion_r4259730524


##########
crates/iceberg/src/spec/manifest_list/mod.rs:
##########
@@ -58,22 +57,39 @@ pub struct ManifestList {
 
 impl ManifestList {
     /// Parse manifest list from bytes.
+    /// Convert each Avro value immediately, retaining only the final typed 
entries.
+    /// A decoding or conversion error still discards the entire result.
     pub fn parse_with_version(bs: &[u8], version: FormatVersion) -> 
Result<ManifestList> {
         match version {
             FormatVersion::V1 => {
                 let reader = 
Reader::with_schema(&MANIFEST_LIST_AVRO_SCHEMA_V1, bs)?;
-                let values = 
Value::Array(reader.collect::<std::result::Result<Vec<Value>, _>>()?);
-                from_value::<_serde::ManifestListV1>(&values)?.try_into()
+                let entries = reader
+                    .map(|value| {
+                        let value = value?;
+                        
from_value::<_serde::ManifestFileV1>(&value)?.try_into()
+                    })
+                    .collect::<Result<Vec<_>>>()?;
+                Ok(ManifestList { entries })
             }
             FormatVersion::V2 => {
                 let reader = Reader::new(bs)?;
-                let values = 
Value::Array(reader.collect::<std::result::Result<Vec<Value>, _>>()?);
-                from_value::<_serde::ManifestListV2>(&values)?.try_into()
+                let entries = reader
+                    .map(|value| {
+                        let value = value?;
+                        
from_value::<_serde::ManifestFileV2>(&value)?.try_into()
+                    })
+                    .collect::<Result<Vec<_>>>()?;
+                Ok(ManifestList { entries })
             }
             FormatVersion::V3 => {
                 let reader = Reader::new(bs)?;
-                let values = 
Value::Array(reader.collect::<std::result::Result<Vec<Value>, _>>()?);
-                from_value::<_serde::ManifestListV3>(&values)?.try_into()
+                let entries = reader
+                    .map(|value| {
+                        let value = value?;
+                        
from_value::<_serde::ManifestFileV3>(&value)?.try_into()
+                    })
+                    .collect::<Result<Vec<_>>>()?;
+                Ok(ManifestList { entries })
             }
         }
     }

Review Comment:
   > Done. I merged `main` and use your `into_deser_iter` version. Peak is now 
4,355,177 bytes, against 31,194,672 on `main`.
   
   Awesome, and thank you for updating the PR description with the new numbers!



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to