comphead opened a new issue, #3825:
URL: https://github.com/apache/iceberg-rust/issues/3825

   ### Is your feature request related to a problem or challenge?
   
   A caller that charges open data files against a memory pool can only read 
`CurrentFileStatus::current_written_size()` from a `ParquetWriter`. That is 
`bytes_written() + in_progress_size()` 
([source](https://github.com/apache/iceberg-rust/blob/6cca8cdec6881d057581bdf9cc21c3ad426c0283/crates/iceberg/src/writer/file_writer/parquet_writer.rs#L823-L827)),
 and `in_progress_size()` is parquet's estimate of the encoded size of the row 
group in progress, not the memory the writer holds for it. The gap can be large:
   
   - Each enabled Bloom filter allocates its whole bitset when the row group's 
column writers are created. With parquet-rs defaults that is about 1 MiB per 
Bloom-filtered column, before any value is inserted.
   - Dictionary encoders keep their hash tables and unencoded indices until the 
row group flushes.
   
   parquet-rs already reports this through `AsyncArrowWriter::memory_size()`, 
which sums `ArrowColumnWriter::memory_size()` over the row group in progress. 
`ParquetWriter` keeps its `AsyncArrowWriter` private, so callers cannot read it.
   
   Apache DataFusion Comet runs into this in its native Iceberg writer. A 
fanout write keeps one `ParquetWriter` open per partition and reserves their 
total from Spark's off-heap memory pool, based on `current_written_size()` 
(https://github.com/apache/datafusion-comet/pull/6247). Bloom filter support 
for those writes (https://github.com/apache/datafusion-comet/pull/5724) adds a 
separately computed allowance for the bitsets because of this.
   
   ### Describe the solution you'd like
   
   Add `ParquetWriter::memory_size(&self) -> usize`, returning the inner 
`AsyncArrowWriter::memory_size()`, or 0 before the first write. It is additive 
and leaves `CurrentFileStatus` unchanged.
   
   ### Willingness to contribute
   
   I can contribute to this feature independently
   


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