Skip to content

Commit

Permalink
[BugFix] Fix Unexpected memory copy (StarRocks#53052)
Browse files Browse the repository at this point in the history
Signed-off-by: stdpain <[email protected]>
  • Loading branch information
stdpain authored Nov 21, 2024
1 parent bce5d05 commit 9aeb07c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions be/src/column/column_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class ColumnHelper {
if (offset0->size() != offset1->size()) {
return false;
}
auto data1 = offset0->get_data();
auto data2 = offset1->get_data();
const auto& data1 = offset0->get_data();
const auto& data2 = offset1->get_data();
return std::equal(data1.begin(), data1.end(), data2.begin());
}

Expand Down
2 changes: 1 addition & 1 deletion be/src/exec/stream/aggregate/stream_aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Status StreamAggregator::_output_result_changes_with_retract(size_t chunk_size,
// compute agg count to decide whehter to generate retract info.
auto agg_count_column = down_cast<const Int64Column*>(
final_result_chunk->get_column_by_index(_group_by_columns.size() + _count_agg_idx).get());
auto agg_count_column_data = agg_count_column->get_data();
const auto& agg_count_column_data = agg_count_column->get_data();

// 2. seek previous results from result state table.
StateTableResult prev_state_result;
Expand Down
2 changes: 1 addition & 1 deletion be/src/exprs/agg/group_concat.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class GroupConcatAggregateFunctionV2
// get null info from output columns
auto output_col_num = ctx->get_num_args() - ctx->get_nulls_first().size() - 1;
NullColumnPtr nulls = NullColumn::create(chunk_size, false);
auto null_data = nulls->get_data();
auto& null_data = nulls->get_data();
for (int j = 0; j < output_col_num; ++j) {
if (src[j]->only_null()) {
for (int i = 0; i < chunk_size; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/exprs/array_functions.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ private:
} else {
bool_array = down_cast<ArrayColumn*>(bool_column.get());
}
auto offsets = bool_array->offsets().get_data();
const auto& offsets = bool_array->offsets().get_data();

ColumnViewer<TYPE_BOOLEAN> bool_elements(bool_array->elements_column());

Expand Down
2 changes: 1 addition & 1 deletion be/src/exprs/utility_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ StatusOr<ColumnPtr> UtilityFunctions::assert_true(FunctionContext* context, cons
column = FunctionHelper::get_data_column_of_nullable(column);
}
auto bool_column = ColumnHelper::cast_to<TYPE_BOOLEAN>(column);
auto data = bool_column->get_data();
const auto& data = bool_column->get_data();
for (size_t i = 0; i < size; ++i) {
if (!data[i]) {
throw std::runtime_error(msg);
Expand Down
2 changes: 1 addition & 1 deletion be/src/storage/column_in_predicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class DictionaryCodeInPredicate : public ColumnPredicate {

if (column->has_null()) {
const NullColumn* null_column = down_cast<const NullableColumn*>(column)->null_column().get();
auto null_data = null_column->get_data();
const auto& null_data = null_column->get_data();
for (auto i = from; i < to; i++) {
auto index = data[i] >= _bit_mask.size() ? 0 : data[i];
filter[i - from] = (!null_data[i]) & _bit_mask[index];
Expand Down

0 comments on commit 9aeb07c

Please sign in to comment.