1717
1818#include " vec/exec/vaggregation_node.h"
1919
20+ #include < memory>
21+
2022#include " exec/exec_node.h"
2123#include " runtime/mem_pool.h"
2224#include " runtime/row_batch.h"
@@ -40,7 +42,7 @@ AggregationNode::AggregationNode(ObjectPool* pool, const TPlanNode& tnode,
4042 _is_merge(false ),
4143 _agg_data() {}
4244
43- AggregationNode::~AggregationNode () {}
45+ AggregationNode::~AggregationNode () = default ;
4446
4547Status AggregationNode::init (const TPlanNode& tnode, RuntimeState* state) {
4648 RETURN_IF_ERROR (ExecNode::init (tnode, state));
@@ -57,8 +59,8 @@ Status AggregationNode::init(const TPlanNode& tnode, RuntimeState* state) {
5759 _aggregate_evaluators.push_back (evaluator);
5860 }
5961
60- auto agg_functions = tnode.agg_node .aggregate_functions ;
61- _is_merge = std::any_of (agg_functions.begin (), agg_functions.end (),
62+ const auto & agg_functions = tnode.agg_node .aggregate_functions ;
63+ _is_merge = std::any_of (agg_functions.cbegin (), agg_functions.cend (),
6264 [](const auto & e) { return e.nodes [0 ].agg_expr .is_merge_agg ; });
6365 return Status::OK ();
6466}
@@ -73,7 +75,7 @@ Status AggregationNode::prepare(RuntimeState* state) {
7375 RETURN_IF_ERROR (
7476 VExpr::prepare (_probe_expr_ctxs, state, child (0 )->row_desc (), expr_mem_tracker ()));
7577
76- _mem_pool. reset ( new MemPool (mem_tracker ().get () ));
78+ _mem_pool = std::make_unique< MemPool> (mem_tracker ().get ());
7779
7880 int j = _probe_expr_ctxs.size ();
7981 for (int i = 0 ; i < _aggregate_evaluators.size (); ++i, ++j) {
@@ -89,7 +91,7 @@ Status AggregationNode::prepare(RuntimeState* state) {
8991 for (size_t i = 0 ; i < _aggregate_evaluators.size (); ++i) {
9092 _offsets_of_aggregate_states[i] = _total_size_of_aggregate_states;
9193
92- const auto agg_function = _aggregate_evaluators[i]->function ();
94+ const auto & agg_function = _aggregate_evaluators[i]->function ();
9395 // aggreate states are aligned based on maximum requirement
9496 _align_aggregate_states = std::max (_align_aggregate_states, agg_function->alignOfData ());
9597 _total_size_of_aggregate_states += agg_function->sizeOfData ();
0 commit comments