Skip to content

BufferedData compares staging memory bytes with a row-count threshold #2446

Description

@zuston

Description

BufferedData::add_batch uses compute_suggested_batch_size_for_output to determine when staged record batches should be sorted and flushed.

However, compute_suggested_batch_size_for_output(mem_size, num_rows) returns a suggested number of rows, while the current condition compares that value with staging_mem_used, which is measured in bytes:

let suggested_batch_size =
    compute_suggested_batch_size_for_output(
        self.staging_mem_used,
        self.staging_num_rows,
    );

if self.staging_mem_used > suggested_batch_size {
    self.flush_staging()?;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions