[refine](column) backport strong typed column helpers to 4.1#64960
Merged
yiguolei merged 4 commits intoJun 30, 2026
Merged
Conversation
…ullable (apache#63491) The null_map column in `ColumnNullable` was stored as a generic `IColumn::WrappedPtr`, requiring `assert_cast<ColumnUInt8>` at every call site that accessed it. This had two problems: 1. **Redundant runtime casts**: Every access to `get_null_map_column()` or `get_null_map_column_ptr()` performed an `assert_cast`, adding unnecessary overhead on hot paths (filter evaluation, null propagation, etc.). 2. **Type safety**: The generic `WrappedPtr` type provided no compile-time guarantee that the null map is always a `ColumnUInt8`, making it possible to accidentally store a wrong column type. Root cause: The `_null_map` member was typed as a generic `IColumn::WrappedPtr` instead of the concrete `ColumnUInt8::WrappedPtr`. Fix: Change `_null_map` to `ColumnUInt8::WrappedPtr` so the type is fixed at the member level. The constructor now validates and converts to `ColumnUInt8::MutablePtr` on entry via a helper `assert_mutable_null_map()`. All call sites that previously did `assert_cast<ColumnUInt8>` now get the correct type directly. 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 --> (cherry picked from commit d0536c0)
Array and map offset subcolumns were still stored and exposed through generic IColumn pointers, so callers had to repeatedly downcast them back to their concrete offset column types. Root cause: the ownership, COW mutation, deserialization, and segment reader write-back paths still treated these offsets as generic subcolumns, which left the strong-typing change incomplete and kept redundant same-type assert_cast usage in affected callers and tests. This change promotes ColumnArray offsets and ColumnMap offsets_column to typed wrapped pointers, updates the typed accessors and generic write-back paths to preserve the concrete offset column type, and removes the now-redundant casts in array functions, lambda functions, and unit tests. It also cleans up one redundant nullable null-map cast uncovered during the BE UT compile. None (cherry picked from commit 2ad56a8)
Problem Summary: Replace direct typeid_cast usage for Doris column type
checks with the column-specific check_and_get_column helper. This keeps
column downcast checks consistent across core column code, expression
evaluation, storage segment code, and related table reader tests without
changing behavior.
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 -->
(cherry picked from commit 0f73bd6)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
yiguolei
approved these changes
Jun 30, 2026
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
2 tasks
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.
What problem does this PR solve?
Related PR: #63491, #63678, #63946, #58092
Problem Summary:
Backport the column strong-typing refinements for branch-4.1: use strong typed nullable null maps, array offsets, and map offsets, and apply the column check helper for type casts. Branch-4.1 was missing the COW/Column cast helper introduced by #58092, so this also ports the minimal helper API needed by the picked changes and adjusts an old array distance code path to use the already strong typed offsets pointer.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)