[branch-4.1](zone-map) Avoid per-row Field temporaries in TypedZoneMapIndexWriter (#62544)#63050
Open
csun5285 wants to merge 1 commit intoapache:branch-4.1from
Open
[branch-4.1](zone-map) Avoid per-row Field temporaries in TypedZoneMapIndexWriter (#62544)#63050csun5285 wants to merge 1 commit intoapache:branch-4.1from
csun5285 wants to merge 1 commit intoapache:branch-4.1from
Conversation
…riter (apache#62544) When writing nullable columns, `append_nullable` splits each block at null boundaries into small non-null runs. | Input block | add_values calls | |--------------------------------------|-----------------------------------------------------------| | `[1, 3, NULL, NULL, 4, 5, 6, NULL]` | `add_values([1,3], count=2)` + `add_values([4,5,6], count=3)` | Each `add_values` call built two heap-allocated `Field` temporaries just to compare min/max — allocation, memcpy, variant dispatch, destructor — per call. Track page min/max as raw `ValType` (the same native type `std::minmax_element` already uses). Materialize `Field` only once at `flush()` time. `block_rows` = post-null-split run length. | Type | block | Baseline (M items/s) | Optimized (M items/s) | Speedup | |---|---:|---:|---:|---:| | Int32 | 1 | 21.9 | 240.3 | **11.0×** | | Int32 | 4 | 75.9 | 353.0 | **4.7×** | | Int32 | 16 | 170.0 | 400.1 | **2.4×** | | Int32 | 64 | 261.9 | 394.4 | **1.5×** | | Int32 | 256 | 314.0 | 419.7 | 1.3× | | Int32 | 1024 | 320.6 | 425.9 | 1.3× | | Int32 | 4096 | 334.2 | 359.3 | 1.1× | | Double | 1 | 16.7 | 181.9 | **10.9×** | | Double | 4 | 47.0 | 168.0 | **3.6×** | | Double | 16 | 120.0 | 310.0 | **2.6×** | | Double | 64 | 223.1 | 425.3 | **1.9×** | | Double | 256 | 315.1 | 469.8 | 1.5× | | Double | 1024 | 358.9 | 477.1 | 1.3× | | Double | 4096 | 373.8 | 483.3 | 1.3× | | String | 1 | 8.0 | 59.2 | **7.4×** | | String | 4 | 21.7 | 57.9 | **2.7×** | | String | 16 | 41.3 | 60.7 | **1.5×** | | String | 64 | 62.9 | 80.6 | 1.3× | | String | 256 | 75.2 | 82.0 | 1.1× | | String | 1024 | 79.4 | 84.0 | 1.1× | | String | 4096 | 80.4 | 83.4 | 1.0× | Small batches (1–16): **2×–11×**. Large batches: no regression. When the columns in the variant are sparse, during compaction, the frequent add calls on the zonemap index cause field creation and field comparison to account for around 12% of CPU usage. After optimization, this drops to 3%. 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: Claude Opus 4.7 (1M context) <noreply@anthropic.com> (cherry picked from commit 555ea5c)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
Author
|
/review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pick from master #62544