[Fix](Status) Handle returned overall Status correctly (#31692)

Handle returned overall Status correctly
This commit is contained in:
Uniqueyou
2024-03-07 20:29:28 +08:00
committed by yiguolei
parent aff09fc9bc
commit 779ca464a5
49 changed files with 134 additions and 137 deletions

View File

@ -415,7 +415,7 @@ Status AggregationNode::alloc_resource(doris::RuntimeState* state) {
// this could cause unable to get JVM
if (_probe_expr_ctxs.empty()) {
// _create_agg_status may acquire a lot of memory, may allocate failed when memory is very few
RETURN_IF_CATCH_EXCEPTION(static_cast<void>(_create_agg_status(_agg_data->without_key)));
RETURN_IF_ERROR(_create_agg_status(_agg_data->without_key));
_agg_data_created_without_key = true;
}
@ -509,7 +509,7 @@ Status AggregationNode::sink(doris::RuntimeState* state, vectorized::Block* in_b
}
if (eos) {
if (_spill_context.has_data) {
static_cast<void>(_try_spill_disk(true));
RETURN_IF_ERROR(_try_spill_disk(true));
RETURN_IF_ERROR(_spill_context.prepare_for_reading());
}
_can_read = true;
@ -555,11 +555,10 @@ Status AggregationNode::_create_agg_status(AggregateDataPtr data) {
return Status::OK();
}
Status AggregationNode::_destroy_agg_status(AggregateDataPtr data) {
void AggregationNode::_destroy_agg_status(AggregateDataPtr data) {
for (int i = 0; i < _aggregate_evaluators.size(); ++i) {
_aggregate_evaluators[i]->function()->destroy(data + _offsets_of_aggregate_states[i]);
}
return Status::OK();
}
Status AggregationNode::_get_without_key_result(RuntimeState* state, Block* block, bool* eos) {
@ -698,7 +697,7 @@ void AggregationNode::_close_without_key() {
//but finally call close to destory agg data, if agg data has bitmapValue
//will be core dump, it's not initialized
if (_agg_data_created_without_key) {
static_cast<void>(_destroy_agg_status(_agg_data->without_key));
_destroy_agg_status(_agg_data->without_key);
_agg_data_created_without_key = false;
}
release_tracker();
@ -795,7 +794,7 @@ Status AggregationNode::_reset_hash_table() {
hash_table.for_each_mapped([&](auto& mapped) {
if (mapped) {
static_cast<void>(_destroy_agg_status(mapped));
_destroy_agg_status(mapped);
mapped = nullptr;
}
});
@ -1509,16 +1508,12 @@ void AggregationNode::_close_with_serialized_key() {
auto& data = *agg_method.hash_table;
data.for_each_mapped([&](auto& mapped) {
if (mapped) {
static_cast<void>(_destroy_agg_status(mapped));
_destroy_agg_status(mapped);
mapped = nullptr;
}
});
if (data.has_null_key_data()) {
auto st = _destroy_agg_status(
data.template get_null_key_data<AggregateDataPtr>());
if (!st) {
throw Exception(st.code(), st.to_string());
}
_destroy_agg_status(data.template get_null_key_data<AggregateDataPtr>());
}
},
_agg_data->method_variant);