Skip to content

Commit

Permalink
[Bug](agg) fix collect_set function core dump without arena pool (#38234
Browse files Browse the repository at this point in the history
)

before the add_range_single_place pass nullptr as arena object,
but collect_set function need save data in arena, so will core dump
without arena pool.
  • Loading branch information
zhangstar333 authored and dataroaring committed Jul 24, 2024
1 parent e389e3c commit 488e877
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions be/src/pipeline/exec/analytic_source_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ void AnalyticLocalState::_destroy_agg_status() {
}
}

//now is execute for lead/lag row_number/rank/dense_rank/ntile functions
//sum min max count avg first_value last_value functions
void AnalyticLocalState::_execute_for_win_func(int64_t partition_start, int64_t partition_end,
int64_t frame_start, int64_t frame_end) {
for (size_t i = 0; i < _agg_functions_size; ++i) {
Expand All @@ -292,7 +290,7 @@ void AnalyticLocalState::_execute_for_win_func(int64_t partition_start, int64_t
partition_start, partition_end, frame_start, frame_end,
_fn_place_ptr +
_parent->cast<AnalyticSourceOperatorX>()._offsets_of_aggregate_states[i],
agg_columns.data(), nullptr);
agg_columns.data(), _agg_arena_pool.get());

// If the end is not greater than the start, the current window should be empty.
_current_window_empty =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
3 ["2023-01-02"] ["hello"]
4 ["2023-01-02", "2023-01-03"] ["sql"]

-- !3 --
["doris", "world", "hello", "sql"]
["doris", "world", "hello", "sql"]
["doris", "world", "hello", "sql"]
["doris", "world", "hello", "sql"]
["doris", "world", "hello", "sql"]
["doris", "world", "hello", "sql"]
["doris", "world", "hello", "sql"]

Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ suite("group_unique_array") {
qt_2 """
select k1,collect_set(k2),collect_set(k3,1) from test_group_unique_array_table group by k1 order by k1;
"""
qt_3 """
select collect_set(k3) over() from test_group_unique_array_table;
"""
}

0 comments on commit 488e877

Please sign in to comment.