laskoviymishka commented on code in PR #779:
URL: https://github.com/apache/iceberg-go/pull/779#discussion_r2937446684


##########
table/arrow_utils.go:
##########
@@ -832,7 +872,12 @@ func (a *arrowProjectionVisitor) Struct(st 
iceberg.StructType, structArr arrow.A
                } else if !field.Required {
                        dt := retOrPanic(TypeToArrowType(field.Type, false, 
a.useLargeTypes))
 
-                       arr = 
array.MakeArrayOfNull(compute.GetAllocator(a.ctx), dt, structArr.Len())
+                       if field.WriteDefault != nil {

Review Comment:
   You don't need to change VisitSchemaWithPartner or any of the visitor 
interface signatures. The flag belongs on ToRequestedSchema only — it already 
has multiple bool params. Internally, store it on the arrowProjectionVisitor 
struct (which is private), and use it in Struct() to decide between 
field.WriteDefault and field.InitialDefault.
   
   Concretely:
   1. Add a useWriteDefault bool parameter to ToRequestedSchema
   2. Store it in arrowProjectionVisitor struct
   3. In Struct(), check a.useWriteDefault to pick field.WriteDefault vs 
field.InitialDefault
   
   The call sites are:
   - Write path (writer.go:120, rolling_data_writer.go:334): pass true
   - Read path (arrow_scanner.go:513, arrow_scanner.go:585): pass false
   
   VisitSchemaWithPartner and name_mapping are untouched — the flag lives 
entirely within the arrow projection layer.



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