fn output_memory_bytes(
inputs: &[FileHandle],
read_parallelism: usize,
retains_dedup_batch: bool,
) -> u64Expand description
Estimates the peak memory of merging inputs into one output, following the read path:
- Every input reader holds its current row group.
- With a read parallelism above 1, every input is read in its own task and also holds batches ahead of the merge: a full channel, one batch being sent and one in the merge. A batch never spans row groups, and the batches of an input never exceed the whole file.
- Inputs read serially hold the batch the merge is consuming.
- The merge retains consumed input batches until it emits an output batch.
LastNonNulldedup keeps the previous output batch.- Merged batches pass a channel to the writer, with one more batch on each side of it.
The writer’s row group buffer, index builders and the batch dedup concatenates when a key spans two batches are not covered.