xanderbailey opened a new pull request, #139:
URL: https://github.com/apache/datafusion-iceberg/pull/139

   ## Which issue does this PR close?
   
   None filed.
   
   ## Rationale for this change
   
   Inserting into a partitioned table that has its own `_partition` column 
fails with `Partition column is not a StructArray`. `repartition`, 
`sort_by_partition` and the partition splitter all find the projected partition 
values by name, and the table's column comes first.
   
   ## What changes are included in this PR?
   
   - Look up the projected column as the last field named `_partition`, since 
`project_with_partition` always appends it after the table columns.
   - `TaskWriter` moves that column to the front before splitting (the splitter 
takes the first match), then drops it from the batches it writes.
   
   Longer term the splitter in iceberg-rust could take a column index instead.
   
   ## Are these changes tested?
   
   Yes: an `insert_into` test, plus unit tests for `TaskWriter` (fanout and 
clustered), `repartition` and `sort_by_partition`. The `insert_into` test reads 
the data files directly, because scanning `_partition` currently returns the 
metadata column (apache/iceberg-rust#3362).
   


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