@@ -46,18 +46,19 @@ TEST(AggTest, basic_test) {
4646 DataTypes data_types = {data_type};
4747 Array array;
4848 auto agg_function = factory.get (" sum" , data_types, array);
49- std::unique_ptr<char []> place (new char [agg_function->size_of_data ()]);
50- agg_function->create (place.get ());
49+ std::unique_ptr<char []> memory (new char [agg_function->size_of_data ()]);
50+ AggregateDataPtr place = memory.get ();
51+ agg_function->create (place);
5152 const IColumn* column[1 ] = {column_vector_int32.get ()};
5253 for (int i = 0 ; i < agg_test_batch_size; i++) {
53- agg_function->add (place. get () , column, i, nullptr );
54+ agg_function->add (place, column, i, nullptr );
5455 }
5556 int ans = 0 ;
5657 for (int i = 0 ; i < agg_test_batch_size; i++) {
5758 ans += i;
5859 }
59- ASSERT_EQ (ans, *reinterpret_cast <int32_t *>(place. get () ));
60- agg_function->destroy (place. get () );
60+ ASSERT_EQ (ans, *reinterpret_cast <int32_t *>(place));
61+ agg_function->destroy (place);
6162}
6263
6364TEST (AggTest, topn_test) {
@@ -78,19 +79,20 @@ TEST(AggTest, topn_test) {
7879 Array array;
7980
8081 auto agg_function = factory.get (" topn" , data_types, array);
81- std::unique_ptr<char []> place (new char [agg_function->size_of_data ()]);
82- agg_function->create (place.get ());
82+ std::unique_ptr<char []> memory (new char [agg_function->size_of_data ()]);
83+ AggregateDataPtr place = memory.get ();
84+ agg_function->create (place);
8385
8486 IColumn* columns[2 ] = {datas[0 ].get (), datas[1 ].get ()};
8587
8688 for (int i = 0 ; i < agg_test_batch_size; i++) {
87- agg_function->add (place. get () , const_cast <const IColumn**>(columns), i, nullptr );
89+ agg_function->add (place, const_cast <const IColumn**>(columns), i, nullptr );
8890 }
8991
90- std::string result = reinterpret_cast <AggregateFunctionTopNData*>(place. get () )->get ();
92+ std::string result = reinterpret_cast <AggregateFunctionTopNData*>(place)->get ();
9193 std::string expect_result=" {\" 1\" :2048,\" 2\" :683,\" 3\" :341,\" 4\" :205,\" 5\" :137,\" 6\" :97,\" 7\" :73,\" 8\" :57,\" 9\" :46,\" 10\" :37}" ;
9294 ASSERT_EQ (result, expect_result);
93- agg_function->destroy (place. get () );
95+ agg_function->destroy (place);
9496}
9597} // namespace doris::vectorized
9698
0 commit comments