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

   ## Which issue does this close?
   
   Part of #26606 (the hash-join side).
   
   ## Rationale for this change
   
   When the 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.
   
   This is the hash-join half of #26606; the `arrow-select` `set_source` 
improvement noted in the issue is separate.
   
   ## Are these changes tested?
   
   Yes. A new unit test (`gc_oversized_view_columns_compacts_fragmented_views`) 
builds the fragmented-views shape and asserts it compacts to a single data 
buffer with values preserved. The full `joins::hash_join` test module (688 
tests) passes; `cargo fmt` and `cargo clippy` are clean.
   
   ## Are there any user-facing changes?
   
   No API changes. Hash joins over string/binary-view build sides use less 
memory and report it accurately; query 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