-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[refine](column) separate mutable subcolumn mutation from read-only traversal #64905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,6 @@ | |
| #include "core/string_ref.h" | ||
| #include "core/types.h" | ||
| #include "exec/common/sip_hash.h" | ||
| #include "util/defer_op.h" | ||
|
|
||
| class SipHash; | ||
|
|
||
|
|
@@ -74,15 +73,10 @@ class ColumnMap final : public COWHelper<IColumn, ColumnMap> { | |
|
|
||
| std::string get_name() const override; | ||
|
|
||
| void for_each_subcolumn(MutableColumnCallback callback) override { | ||
| IColumn::WrappedPtr offsets(std::move(static_cast<COffsets::Ptr&>(offsets_column))); | ||
| Defer defer([&] { | ||
| static_cast<COffsets::Ptr&>(offsets_column) = | ||
| cast_to_column<COffsets>(static_cast<const IColumn::Ptr&>(offsets)); | ||
| }); | ||
| callback(keys_column); | ||
| callback(values_column); | ||
| callback(offsets); | ||
| void mutate_subcolumns() override { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This COW refactor changes |
||
| mutate_subcolumn(keys_column); | ||
| mutate_subcolumn(values_column); | ||
| mutate_subcolumn<COffsets>(offsets_column); | ||
| } | ||
|
|
||
| void for_each_subcolumn(ColumnCallback callback) const override { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new hook still needs a shared-detach test. The added array COW test builds the array from moved mutable children and then calls
IColumn::mutate(std::move(array)), so it only exercises the exclusive fast path; it would not catch a regression where the by-value/sharedIColumn::mutate(array)path forgets to detach either the nested data or the typed offsets. Please add a small test analogous to the nullable/map shared tests that keeps aliases to both child columns, callsIColumn::mutate(array)without moving the source owner, and verifies the result detached both children while the aliases remain unchanged. Since this PR also addsmutate_subcolumns()hooks forColumnConstandColumnStruct, small direct mutate tests for those hooks would keep the COW refactor covered across all changed composite columns.