[opt](explode) Optimize explode_outer and posexplode#62069
[opt](explode) Optimize explode_outer and posexplode#62069yiguolei merged 3 commits intoapache:masterfrom
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-H: Total hot run time: 29612 ms |
TPC-DS: Total hot run time: 180152 ms |
4b0a118 to
c3c661d
Compare
|
run buildall |
|
/review |
|
No blocking issues found in this PR. Critical checkpoint conclusions:
Overall opinion: looks correct and sufficiently contained, with only a minor residual test gap around direct |
TPC-H: Total hot run time: 29032 ms |
TPC-DS: Total hot run time: 178944 ms |
|
/review |
|
No issues found in this review. Checkpoint conclusions:
Residual risk: variant-array / broader integration behavior was not exercised locally in this runner because the BE UT command did not finish setup in time. |
|
run buildall |
TPC-H: Total hot run time: 29242 ms |
TPC-DS: Total hot run time: 178889 ms |
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
TPC-H: Total hot run time: 29088 ms |
TPC-DS: Total hot run time: 177616 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Issue Number: close #xxx Related PR: #xxx Problem Summary: Improvement of apache#60352, optimize explode_outer, posexplode and posexplode_outer. The approach is a single-pass algorithm: walk through child rows, accumulating contiguous segments into the output, then when hitting a null/empty row or reaching the end, flush the segment using bulk operations. For outer-null rows, insert a NULL and copy the non-table-function columns directly. This naturally handles both outer and non-outer modes since non-outer mode just won't produce any null outputs. For posexplode, generate position indices alongside this. Performance test result. Create and populate a large test table. Use 100,000,000 base rows, each with an array of 10 INT elements, producing 1,000,000,000 total exploded output rows. | Function | slow path | optimized | SpeedUp| | --------- |---------- |-----------|----------| | explode | 9734 ms | 5105 ms |90%| | explode_outer | 9685 ms | 5064 ms |91%| | posexplode | 11021 ms | 5963 ms |84%| | posexplode_outer | 14088 ms | 5903 ms |138%| 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 -->
### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: Improvement of apache#60352, optimize explode_outer, posexplode and posexplode_outer. The approach is a single-pass algorithm: walk through child rows, accumulating contiguous segments into the output, then when hitting a null/empty row or reaching the end, flush the segment using bulk operations. For outer-null rows, insert a NULL and copy the non-table-function columns directly. This naturally handles both outer and non-outer modes since non-outer mode just won't produce any null outputs. For posexplode, generate position indices alongside this. Performance test result. Create and populate a large test table. Use 100,000,000 base rows, each with an array of 10 INT elements, producing 1,000,000,000 total exploded output rows. | Function | slow path | optimized | SpeedUp| | --------- |---------- |-----------|----------| | explode | 9734 ms | 5105 ms |90%| | explode_outer | 9685 ms | 5064 ms |91%| | posexplode | 11021 ms | 5963 ms |84%| | posexplode_outer | 14088 ms | 5903 ms |138%| ### Release note None ### 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 -->
Issue Number: Pick #62069 Related PR: #xxx Problem Summary: Improvement of #60352, optimize explode_outer, posexplode and posexplode_outer. The approach is a single-pass algorithm: walk through child rows, accumulating contiguous segments into the output, then when hitting a null/empty row or reaching the end, flush the segment using bulk operations. For outer-null rows, insert a NULL and copy the non-table-function columns directly. This naturally handles both outer and non-outer modes since non-outer mode just won't produce any null outputs. For posexplode, generate position indices alongside this. Performance test result. Create and populate a large test table. Use 100,000,000 base rows, each with an array of 10 INT elements, producing 1,000,000,000 total exploded output rows. | Function | slow path | optimized | SpeedUp| | --------- |---------- |-----------|----------| | explode | 9734 ms | 5105 ms |90%| | explode_outer | 9685 ms | 5064 ms |91%| | posexplode | 11021 ms | 5963 ms |84%| | posexplode_outer | 14088 ms | 5903 ms |138%| 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 --> ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### 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 -->
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Improvement of #60352, optimize explode_outer, posexplode and posexplode_outer.
The approach is a single-pass algorithm: walk through child rows, accumulating contiguous segments into the output, then when hitting a null/empty row or reaching the end, flush the segment using bulk operations. For outer-null rows, insert a NULL and copy the non-table-function columns directly. This naturally handles both outer and
non-outer modes since non-outer mode just won't produce any null outputs. For posexplode, generate position indices alongside this.
Performance test result.
Create and populate a large test table. Use 100,000,000 base rows, each with an array of 10 INT elements, producing 1,000,000,000 total exploded output rows.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)