Skip to content

Idea: Avoid planning CoalesceBatches in front of blocking operators. #15478

Closed

Description

@ctsk

The blocking operators (HJ buid side, Aggregation) are often planned on top of a RepartitionExec with a CoalesceBatchesExec in-between. However, one of the first things these operators do is concatenate the freshly coalesced batches - Maybe there is no benefit from adding the coalesce's here?

I've prototyped an implementation here: #15479

Activity

  1. ctsk commented on Mar 28, 2025

    @ctsk
    ContributorAuthor

    One downside: Increased memory usage.

    The hash join build side stores the RecordBatches in a vector before building the hash table. This vector will grow larger. In addition, we might delay e.g. garbage collection for StringViews, which also increases memory usage.

  2. Dandandan commented on Mar 29, 2025

    @Dandandan
    Contributor

    One downside: Increased memory usage.

    The hash join build side stores the RecordBatches in a vector before building the hash table. This vector will grow larger. In addition, we might delay e.g. garbage collection for StringViews, which also increases memory usage.

    Perhaps instead of removing the coalescebatches, we can change the the threshold ratio to be much smaller (e.g. 1/10th (or something based on some benchmarkig) of the size instead of 1/2). That way the overhead of Vec is minimal while probably still redundant copying in many cases.

  3. alamb commented on Jan 6, 2026

    @alamb
    Contributor

    We have now removed the operator entirely via

    And we have incorporated the coalescing in the relevant operators)

    So I think this issue is now complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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