shangxinli commented on code in PR #942:
URL: https://github.com/apache/iceberg-cpp/pull/942#discussion_r4401894481


##########
src/iceberg/schema_util.cc:
##########
@@ -104,15 +104,22 @@ Result<FieldProjection> ProjectField(const SchemaField& 
expected_field,
                          expected_field.field_id());
   }
   if (source_field.type()->type_id() == TypeId::kUnknown &&
-      expected_field.type()->is_nested()) {
+      (expected_field.type()->is_nested() || mode == ProjectionMode::kWrite)) {
+    // The write path must materialize nulls with the expected type rather 
than copy
+    // the source's unknown array into a differently typed column.
     projection.kind = FieldProjection::Kind::kNull;
     return projection;
   }
 
   if (expected_field.type()->is_nested()) {
     ICEBERG_ASSIGN_OR_RAISE(
         projection,
-        ProjectNested(*expected_field.type(), *source_field.type(), 
prune_source));
+        ProjectNested(*expected_field.type(), *source_field.type(), 
prune_source, mode));
+  } else if (mode == ProjectionMode::kWrite) {

Review Comment:
   fixed - write mode now rejects optional-into-required with the same message 
Java uses.



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