Skip to content

Extra memory allocated during partial aggregation early emit during OOM handling #22164

@ariel-miculas-trif

Description

@ariel-miculas-trif

Describe the bug

When the partial hash aggregation with GroupOrdering::None cannot reserve more memory, it switches to an early emit phase with EmitTo::First(n), where n is close to the length of group_values. take_n implementations use first_n_offsets = self.offsets.drain(0..n).collect::<Vec<_>>();, which copies the n elements into a new allocation. Furthermore, drain doesn't affect the Vec's capacity, so no memory freeing is done.

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions