Skip to content

[fix](exec) Backport batched rowid reads for lazy materialization to 4.2 - #69429

Merged
yiguolei merged 1 commit into
apache:branch-4.2from
Mryange:branch-4.2-pick-63436
Oct 23, 2026
Merged

yiguolei merged 1 commit into
apache:branch-4.2from
Mryange:branch-4.2-pick-63436

Conversation

@Mryange

@Mryange Mryange commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: N/A

Related PR: #63436, #69331

Problem Summary:

Backport #63436 to branch-4.2 using the branch-4.1 adaptation from #69331. TopN lazy materialization can hang when a join produces duplicate or out-of-order physical rowids. Root cause: reusing a column iterator for these requests can underflow the RLE decoder's unsigned skip count. Group requests by segment, sort and deduplicate rowids before batch reads, then scatter results back to preserve request order and duplicate rows.

The backport preserves branch-4.2 COW ownership, Variant V2 handling, rowid range checks, file cache policy, and existing external row-fetch fixes. The existing Variant segment-reader test is adapted to the batch interface. No additional prerequisite PRs are included.

Release note

Fix TopN lazy materialization hanging on duplicate or out-of-order rowids from joins.

Check List (For Author)

  • Test:
    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
      • Static checks only: clang-format 16 and git diff --check passed.
      • Build, unit tests, and SQL regression tests have not been run for this 4.2 backport.
  • Behavior changed:
    • No.
    • Yes. Duplicate and out-of-order rowids are normalized before storage reads; output order and duplicates are preserved.
  • 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

Backport apache#63436 via the branch-4.1 adaptation in apache#69331.

Group requests by segment, sort and deduplicate rowids before batch reads,
and scatter results back to preserve request order and duplicate rows.
Preserve branch-4.2 COW ownership, Variant V2 handling, rowid range checks,
file cache policy, and external row-fetch fixes. Adapt the existing Variant
segment-reader test to the batch interface.

Validation: clang-format 16 and git diff --check passed.
Build, unit tests, and SQL regression tests were not run for this backport.

(cherry picked from commit 12f02eb)
(cherry picked from commit 3727196)
@Mryange
Mryange requested a review from yiguolei as a code owner October 22, 2026 04:26
@hello-stephen

Copy link
Copy Markdown
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?

@Mryange

Mryange commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 15.87% (10/63) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 64.26% (29893/46518)
Line Coverage 49.11% (315268/642008)
Region Coverage 44.94% (253903/564950)
Branch Coverage 46.59% (119838/257221)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 96.83% (61/63) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 76.38% (34507/45177)
Line Coverage 61.22% (389740/636651)
Region Coverage 58.03% (328379/565871)
Branch Coverage 59.02% (151640/256937)

@yiguolei

Copy link
Copy Markdown
Contributor

skip buildall

@yiguolei
yiguolei merged commit 72df240 into apache:branch-4.2 Oct 23, 2026
31 of 32 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.

4 participants