anoopj commented on code in PR #2845:
URL: https://github.com/apache/iceberg-rust/pull/2845#discussion_r3624951453


##########
crates/iceberg/src/arrow/record_batch_transformer.rs:
##########
@@ -59,11 +59,11 @@ fn constants_map(
     for (pos, field) in partition_spec.fields().iter().enumerate() {
         // Only identity transforms should use constant values from partition 
metadata
         if matches!(field.transform, Transform::Identity) {
-            // Get the field from schema to extract its type
-            let iceberg_field = 
schema.field_by_id(field.source_id).ok_or(Error::new(
-                ErrorKind::Unexpected,
-                format!("Field {} not found in schema", field.source_id),
-            ))?;
+            // The source column may have been dropped from the schema after 
the spec was
+            // created. It cannot be projected in that case, so no constant is 
needed.
+            let Some(iceberg_field) = schema.field_by_id(field.source_id) else 
{

Review Comment:
   Thanks for the review. I have filed followup to fix these 
https://github.com/apache/iceberg-rust/pull/2869



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