Fokko opened a new issue, #4499:
URL: https://github.com/apache/iceberg-python/issues/4499

   Follow up to #3447.
   
   Since #3447, `tbl.append()` and `tbl.overwrite()` accept any Arrow PyCapsule 
stream, such as a Polars DataFrame, and stream it into unpartitioned tables 
through `bin_pack_record_batches`. That function never splits a batch, and a 
Polars DataFrame built in one go exports a single chunk, so the whole frame 
ends up in one data file regardless of `write.target-file-size-bytes`. 
Converting with `pa.table(df)` first goes through `bin_pack_arrow_table`, which 
does split by rows.
   
   With 500k rows and `write.target-file-size-bytes=1048576` on an 
unpartitioned table:
   
   ```python
   tbl.append(pa.table(polars_df))  # 18 data files
   tbl.append(polars_df)            # 1 data file
   ```
   
   The same applies to any `pa.RecordBatchReader` that yields large batches.
   
   Proposal: in `bin_pack_record_batches`, slice an incoming batch that would 
push the buffer past the target size (`RecordBatch.slice` is zero copy), so 
streamed input honors the target file size the same way `pa.Table` input does. 
Once that's in, the "A streamed batch is never split" note in 
`mkdocs/docs/api.md` can be dropped.
   


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