BatchCoalescer: add a target batch size in bytes
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
Direzione di ricerca
Find BatchCoalescer and its primitive and view builders in the Rust source; read how batches are sized, finished, and allocated, then trace the existing biggest_coalesce_batch_size bypass. Implement the optional byte target using the stated per-batch average row size and right-sized output buffers. Done means byte-targeted batches split as described, including oversized batches and single rows, while behavior without a target remains unchanged; add or run the relevant tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem or challenge?
BatchCoalescer completes an output batch at target_batch_size rows and has no notion of bytes. With wide rows that makes very large batches: 8,192 rows of 10,000 Float64 columns are 655 MB, and 8,192 rows that each hold a 100 KB list are about 800 MB. Operators downstream then have to buffer, sort or spill such a batch whole. DataFusion's sort reserves roughly twice a batch's size before buffering it, so one of these batches fails a memory-limited query that has plenty of room for the same rows in smaller batches.
A caller cannot fix this from outside. Lowering target_batch_size penalizes narrow rows, and the row width is not known before the data arrives and can change during a stream. Calling finish_buffered_batch early does cut a batch, but the primitive and view builders reserve target_batch_size values for every output batch and hand that capacity to the array, so a batch cut at 100 rows still holds buffers allocated for 8,192.
Describe the solution you'd like
An optional byte target next to the row target:
let coalescer = BatchCoalescer::new(schema, 8192)
.with_target_batch_bytes(Some(32 * 1024 * 1024));
With a target, an output batch is also completed once the rows buffered for it reach that many bytes. Each row counts as an equal share of the batch it arrived in (ArrayData::get_slice_memory_size divided by the row count), which costs one pass over the columns per pushed batch and nothing per row. A batch larger than the target is split instead of taking the biggest_coalesce_batch_size bypass, a single row larger than the target is a batch of its own, and each output batch's buffers are allocated for the rows it is expected to hold. Without a target nothing changes.
Describe alternatives you've considered
- A wrapper around
BatchCoalescerthat measures input batches and callsfinish_buffered_batch. It cannot avoid the full-size allocation described above, and it cannot split a filtered push without materializing it first. - Exact per-row sizes instead of the batch average. That is precise for rows of uneven size, but needs a pass over the offsets of every variable-width column, nested ones included. The average keeps the cost per batch and can be refined later.
- A re-chunking operator in the query engine (apache/datafusion#23390 proposed one for data sources). It bounds what one operator emits, but every operator that coalesces after it builds large batches again.
Additional context
DataFusion's filter, hash join, sort-merge join and nested loop join build their output through BatchCoalescer, so a target here gives each of them a byte bound with one builder call.
Willingness to contribute
I plan to contribute to this feature independently
- Lingua principale
- Rust
- Stelle
- 3.7k
- Fork
- 1.5k
- Merge medio
- 2g 16h
- PR unite (30g)
- 183
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/arrow-rs
-
parquet: `ArrowWriter::try_new` panics on a schema with a Union field instead of returning an errorAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
`RunArray::try_new` rejects run ends whose null buffer has no nullsForse già presa @Surajsuthar l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/arrow-rs#12427 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Variant] `variant_get` string and binary cast errors show Rust builder type namesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/arrow-rs
Issue simili
-
area:ui effort:medium enhancement P7 source:agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousApertamaintainer-needed p2 remote triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
userFRM/egui-charts#4605 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno