Skip to content

[branch-4.1](spill) Support multi-level partition spilling (#61212)#61677

Merged
yiguolei merged 1 commit intoapache:branch-4.1from
mrhhsg:pick_spill
Mar 25, 2026
Merged

[branch-4.1](spill) Support multi-level partition spilling (#61212)#61677
yiguolei merged 1 commit intoapache:branch-4.1from
mrhhsg:pick_spill

Conversation

@mrhhsg
Copy link
Member

@mrhhsg mrhhsg commented Mar 24, 2026

Pick #61212

This PR adds support for spill repartition in partitioned operators.

When memory is still insufficient after a partition has been spilled, the spilled partition can be repartitioned into smaller sub-partitions, which further reduces peak memory usage. The repartitioner is made level-aware so repartition can be applied recursively when needed.

This PR also integrates the new spill repartition flow into partitioned hash join and partitioned aggregation, adds force-spill logic in the join sink operator, refactors spill file interfaces, improves spill metadata maintenance and memory-pressure handling, and fixes several spill-related issues such as revocable memory accounting and profile updates.

Related PR: #xxx

Problem Summary:

None

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
  • This is a refactor/code format and no logic has been changed.
    - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason

  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
  • Yes.

  • Confirm the release note

  • Confirm test cases

  • Confirm document

  • Add branch pick label


What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

This PR adds support for spill repartition in partitioned operators.

When memory is still insufficient after a partition has been spilled,
the spilled partition can be repartitioned into smaller sub-partitions,
which further reduces peak memory usage. The repartitioner is made
level-aware so repartition can be applied recursively when needed.

This PR also integrates the new spill repartition flow into partitioned
hash join and partitioned aggregation, adds force-spill logic in the
join sink operator, refactors spill file interfaces, improves spill
metadata maintenance and memory-pressure handling, and fixes several
spill-related issues such as revocable memory accounting and profile
updates.

Related PR: #xxx

Problem Summary:

None

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [ ] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->

---------

Co-authored-by: yiguolei <guolei@selectdb.com>
@mrhhsg mrhhsg requested a review from yiguolei as a code owner March 24, 2026 09:51
@Thearas
Copy link
Contributor

Thearas commented Mar 24, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@mrhhsg
Copy link
Member Author

mrhhsg commented Mar 24, 2026

run buildall

@hello-stephen
Copy link
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 78.54% (1786/2274)
Line Coverage 64.35% (32020/49759)
Region Coverage 65.16% (16012/24572)
Branch Coverage 55.65% (8523/15314)

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 84.58% (1805/2134) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.74% (19518/37011)
Line Coverage 36.12% (182060/504081)
Region Coverage 32.42% (140530/433513)
Branch Coverage 33.62% (61646/183366)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 84.97% (1804/2123) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.86% (26027/36219)
Line Coverage 55.03% (276453/502364)
Region Coverage 52.56% (229955/437479)
Branch Coverage 54.15% (99581/183886)

1 similar comment
@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 84.97% (1804/2123) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.86% (26027/36219)
Line Coverage 55.03% (276453/502364)
Region Coverage 52.56% (229955/437479)
Branch Coverage 54.15% (99581/183886)

@yiguolei yiguolei merged commit 7291eff into apache:branch-4.1 Mar 25, 2026
25 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants