Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions be/src/common/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Exception : public std::exception {
public:
Exception() : _code(ErrorCode::OK) {}
Exception(int code, const std::string_view msg);
Exception(const Status& status) : Exception(status.code(), status.msg()) {}
// add nested exception as first param, or the template may could not find
// the correct method for ...args
Exception(const Exception& nested, int code, const std::string_view msg);
Expand Down
13 changes: 10 additions & 3 deletions be/src/vec/aggregate_functions/aggregate_function_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ struct AggregateFunctionSortData {
PBlock pblock;
size_t uncompressed_bytes = 0;
size_t compressed_bytes = 0;
block.serialize(state->be_exec_version(), &pblock, &uncompressed_bytes, &compressed_bytes,
segment_v2::CompressionTypePB::SNAPPY);
auto st = block.serialize(state->be_exec_version(), &pblock, &uncompressed_bytes,
&compressed_bytes, segment_v2::CompressionTypePB::SNAPPY);
if (!st.ok()) {
throw doris::Exception(st);
}

write_string_binary(pblock.SerializeAsString(), buf);
}
Expand All @@ -88,7 +91,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) {
Expand Down
Loading