github-actions[bot] commented on code in PR #27449:
URL: https://github.com/apache/doris/pull/27449#discussion_r1402889913
##########
be/src/pipeline/pipeline_x/dependency.h:
##########
@@ -280,6 +288,49 @@ struct AggSharedState : public BasicSharedState {
};
MemoryRecord mem_usage_record;
std::unique_ptr<MemTracker> mem_tracker =
std::make_unique<MemTracker>("AggregateOperator");
+ bool agg_data_created_without_key = false;
+
+private:
+ void _release_tracker() {
+ mem_tracker->release(mem_usage_record.used_in_state +
mem_usage_record.used_in_arena);
+ }
+ void _close_with_serialized_key() {
+ std::visit(
+ [&](auto&& agg_method) -> void {
+ auto& data = *agg_method.hash_table;
+ data.for_each_mapped([&](auto& mapped) {
+ if (mapped) {
+ static_cast<void>(_destroy_agg_status(mapped));
+ mapped = nullptr;
+ }
+ });
+ if (data.has_null_key_data()) {
+ auto st = _destroy_agg_status(
+ data.template
get_null_key_data<vectorized::AggregateDataPtr>());
+ if (!st) {
+ throw Exception(st.code(), st.to_string());
+ }
+ }
+ },
+ agg_data->method_variant);
+ _release_tracker();
+ }
+ void _close_without_key() {
+ //because prepare maybe failed, and couldn't create agg data.
+ //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));
+ agg_data_created_without_key = false;
+ }
+ _release_tracker();
+ }
+ Status _destroy_agg_status(vectorized::AggregateDataPtr data) {
Review Comment:
warning: method '_destroy_agg_status' can be made static
[readability-convert-member-functions-to-static]
```suggestion
static Status _destroy_agg_status(vectorized::AggregateDataPtr data) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]