Skip to content

Conversation

@BiteTheDDDDt
Copy link
Contributor

@BiteTheDDDDt BiteTheDDDDt commented Dec 23, 2025

What problem does this PR solve?

This pull request refactors the sorting queue implementation in be/src/vec/core/sort_cursor.h to simplify the codebase by removing the SortingQueueStrategy enum and the related template specialization logic. The new approach introduces a dedicated SortingQueueBatch class, streamlining the sorting queue logic and reducing code complexity.

Refactoring and simplification of sorting queue logic:

  • Removed the SortingQueueStrategy enum and the SortingQueueImpl template specialization, replacing them with a single SortingQueueBatch class that handles batch sorting logic directly.
  • Consolidated the current() and next() methods to remove conditional compilation and strategy checks, simplifying their interfaces for batch processing.
  • Removed unnecessary if constexpr blocks and strategy-dependent code, making batch size updates unconditional where appropriate. [1] [2] [3]
  • Updated type aliases to remove references to the old SortingQueueImpl and strategy-based specializations, leaving only the new SortingQueueBatch.

Minor cleanup:

  • Removed redundant default initialization of _block_supplier in BlockSupplierSortCursorImpl.

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

@hello-stephen
Copy link
Contributor

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?

@BiteTheDDDDt
Copy link
Contributor Author

run buildall

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Dec 23, 2025
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 92.31% (12/13) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 72.23% (25017/34636)
Line Coverage 58.98% (262571/445198)
Region Coverage 53.86% (218317/405320)
Branch Coverage 55.39% (93574/168950)

Copy link
Member

@mrhhsg mrhhsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yiguolei yiguolei merged commit 6bcd55e into apache:master Dec 23, 2025
29 of 31 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 23, 2025
### What problem does this PR solve?
This pull request refactors the sorting queue implementation in
`be/src/vec/core/sort_cursor.h` to simplify the codebase by removing the
`SortingQueueStrategy` enum and the related template specialization
logic. The new approach introduces a dedicated `SortingQueueBatch`
class, streamlining the sorting queue logic and reducing code
complexity.

**Refactoring and simplification of sorting queue logic:**

* Removed the `SortingQueueStrategy` enum and the `SortingQueueImpl`
template specialization, replacing them with a single
`SortingQueueBatch` class that handles batch sorting logic directly.
* Consolidated the `current()` and `next()` methods to remove
conditional compilation and strategy checks, simplifying their
interfaces for batch processing.
* Removed unnecessary `if constexpr` blocks and strategy-dependent code,
making batch size updates unconditional where appropriate.
[[1]](diffhunk://#diff-6e09b43a2f90fe07546a69275b5e29af2e1f35e86be173b662b12192996b54f7L337-L354)
[[2]](diffhunk://#diff-6e09b43a2f90fe07546a69275b5e29af2e1f35e86be173b662b12192996b54f7L393-L395)
[[3]](diffhunk://#diff-6e09b43a2f90fe07546a69275b5e29af2e1f35e86be173b662b12192996b54f7L427-L430)
* Updated type aliases to remove references to the old
`SortingQueueImpl` and strategy-based specializations, leaving only the
new `SortingQueueBatch`.

**Minor cleanup:**

* Removed redundant default initialization of `_block_supplier` in
`BlockSupplierSortCursorImpl`.
### Check List (For Author)

- 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 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
yiguolei pushed a commit that referenced this pull request Dec 24, 2025
…#59294)

Cherry-picked from #59279

Co-authored-by: Pxl <xl@selectdb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.0.3-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants