You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/01/31 15:54:16 UTC
(doris) 04/37: [fix](cluster by) Fix cluster_by used-after-moved in compaction (#29273)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 1a8e281255cef51c277dc3d4a949193c754ea5af
Author: meiyi <my...@gmail.com>
AuthorDate: Tue Jan 30 17:21:47 2024 +0800
[fix](cluster by) Fix cluster_by used-after-moved in compaction (#29273)
---
be/src/olap/merger.cpp | 6 ++++--
be/src/olap/tablet_schema.h | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/be/src/olap/merger.cpp b/be/src/olap/merger.cpp
index 714eb04e4d9..2fff21c493c 100644
--- a/be/src/olap/merger.cpp
+++ b/be/src/olap/merger.cpp
@@ -181,9 +181,11 @@ void Merger::vertical_split_columns(TabletSchemaSPtr tablet_schema,
if (!key_columns.empty()) {
column_groups->emplace_back(std::move(key_columns));
}
- for (auto i = num_key_cols; i < total_cols; ++i) {
+ auto&& cluster_key_idxes = tablet_schema->cluster_key_idxes();
+ for (uint32_t i = num_key_cols; i < total_cols; ++i) {
if (i == sequence_col_idx || i == delete_sign_idx ||
- key_columns.end() != std::find(key_columns.begin(), key_columns.end(), i)) {
+ cluster_key_idxes.end() !=
+ std::find(cluster_key_idxes.begin(), cluster_key_idxes.end(), i)) {
continue;
}
if ((i - num_key_cols) % config::vertical_compaction_num_columns_per_group == 0) {
diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h
index 613db2dcbae..a515095814f 100644
--- a/be/src/olap/tablet_schema.h
+++ b/be/src/olap/tablet_schema.h
@@ -266,7 +266,7 @@ public:
std::vector<TabletColumn>& mutable_columns();
size_t num_columns() const { return _num_columns; }
size_t num_key_columns() const { return _num_key_columns; }
- std::vector<uint32_t> cluster_key_idxes() const { return _cluster_key_idxes; }
+ const std::vector<uint32_t>& cluster_key_idxes() const { return _cluster_key_idxes; }
size_t num_null_columns() const { return _num_null_columns; }
size_t num_short_key_columns() const { return _num_short_key_columns; }
size_t num_rows_per_row_block() const { return _num_rows_per_row_block; }
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org