diff --git a/be/src/vec/aggregate_functions/aggregate_function_sort.h b/be/src/vec/aggregate_functions/aggregate_function_sort.h index 31539c3c24636a..466aa15786a258 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_sort.h +++ b/be/src/vec/aggregate_functions/aggregate_function_sort.h @@ -89,7 +89,11 @@ struct AggregateFunctionSortData { PBlock pblock; pblock.ParseFromString(data); auto st = block.deserialize(pblock); - CHECK(st.ok()); + // If memory allocate failed during deserialize, st is not ok, throw exception here to + // stop the query. + if (!st.ok()) { + throw doris::Exception(st); + } } void add(const IColumn** columns, size_t columns_num, size_t row_num) { diff --git a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h index 84222f0d01ba0c..f50a767a1a66b2 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h +++ b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h @@ -355,8 +355,10 @@ struct WindowFunnelState { } Block block; auto status = block.deserialize(pblock); + // If memory allocate failed during deserialize, st is not ok, throw exception here to + // stop the query. if (!status.ok()) { - throw doris::Exception(ErrorCode::INTERNAL_ERROR, status.to_string()); + throw doris::Exception(status); } mutable_block = MutableBlock(std::move(block)); _reset_columns_ptr();