liurenjie1024 commented on code in PR #1561:
URL: https://github.com/apache/iceberg-rust/pull/1561#discussion_r2256730104


##########
crates/iceberg/src/arrow/value.rs:
##########
@@ -451,22 +483,31 @@ impl PartnerAccessor<ArrayRef> for ArrowArrayAccessor {
             .ok_or_else(|| {
                 Error::new(
                     ErrorKind::DataInvalid,
-                    "The struct partner is not a struct array",
+                    format!(
+                        "The struct partner is not a struct array, partner: 
{:?}",
+                        struct_partner
+                    ),
                 )
             })?;
 
         let field_pos = struct_array
             .fields()
             .iter()
-            .position(|arrow_field| {
-                get_field_id(arrow_field)
-                    .map(|id| id == field.id)
-                    .unwrap_or(false)
-            })
+            .position(|arrow_field| self.arrow_field_matches_id(arrow_field, 
field.id))

Review Comment:
   I think we still have misunderstanding here. As I have said 
https://github.com/apache/iceberg-rust/issues/1560#issuecomment-3149922656 , 
for the `nan_val_cnt` case, we should match field to arrow array using the 
field's position(e.g. the rank of this field in struct) rather than by id or 
name.  It's not easy to accomplish with currentl interface, so we should change 
the interface of `PartnerAccessor`, see comments below.



##########
crates/iceberg/src/spec/schema/visitor.rs:
##########
@@ -190,7 +190,7 @@ pub trait SchemaWithPartnerVisitor<P> {
 /// Accessor used to get child partner from parent partner.
 pub trait PartnerAccessor<P> {
     /// Get the struct partner from schema partner.
-    fn struct_parner<'a>(&self, schema_partner: &'a P) -> Result<&'a P>;
+    fn struct_partner<'a>(&self, schema_partner: &'a P) -> Result<&'a P>;
     /// Get the field partner from struct partner.
     fn field_partner<'a>(&self, struct_partner: &'a P, field: &NestedField) -> 
Result<&'a P>;

Review Comment:
   ```suggestion
       fn field_partner<'a>(&self, struct_partner: &'a P, field: &NestedField, 
field_pos: usize) -> Result<&'a P>;
   ```



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