osscm opened a new pull request, #27484:
URL: https://github.com/apache/datafusion/pull/27484

   ## Which issue does this PR close?
   
   Closes part of #26606 (the hash-join build side; the `arrow-select` 
`set_source` improvement noted in the issue is separate).
   
   ## Rationale for this change
   
   When the hash-join build side is concatenated into a single batch, a 
`Utf8View`/`BinaryView` column can end up carrying roughly one data buffer per 
input batch. A downstream join references that consolidated batch from every 
output batch, so each subsequent join retains and re-counts all of those 
buffers: the build `output_bytes` blows up (hundreds of GB in the reported 
case) and the build memory metric over-counts.
   
   ## What changes are included in this PR?
   
   After concatenating the build batches, compact any view column whose 
data-buffer count averages fewer than four rows per buffer, using 
`GenericByteViewArray::gc()` to rewrite it into a single buffer. This drops the 
shared input buffers, so the retained size is both smaller and accurately 
accounted. Columns that are already compact (one buffer) or fully inlined stay 
on the zero-copy path untouched.
   
   ## Are these changes tested?
   
   Yes. A new unit test (`gc_oversized_view_columns_compacts_fragmented_views`) 
plus the full `joins::hash_join` module (688 tests) pass; `cargo fmt` and 
`cargo clippy` are clean.
   
   ## Are there any user-facing changes?
   
   No. This is an internal memory/accounting improvement in hash join; results 
are unchanged.
   


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