@@ -26,157 +26,135 @@ TEST(function_bitmap_test, function_bitmap_min_test) {
2626 std::string func_name = " bitmap_min" ;
2727 InputTypeSet input_types = {TypeIndex::BitMap};
2828
29- auto bitmap1 = new BitmapValue (1 );
30- auto bitmap2 = new BitmapValue (std::vector< uint64_t >( {1 , 9999999 }) );
31- auto empty_bitmap = new BitmapValue () ;
32- DataSet data_set = {{{bitmap1}, (int64_t )1 },
33- {{bitmap2}, (int64_t )1 },
34- {{empty_bitmap}, Null ()},
29+ BitmapValue bitmap1 (1 );
30+ BitmapValue bitmap2 ( {1 , 9999999 });
31+ BitmapValue empty_bitmap;
32+ DataSet data_set = {{{& bitmap1}, (int64_t )1 },
33+ {{& bitmap2}, (int64_t )1 },
34+ {{& empty_bitmap}, Null ()},
3535 {{Null ()}, Null ()}};
3636
3737 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
38- delete bitmap1;
39- delete bitmap2;
40- delete empty_bitmap;
4138}
4239TEST (function_bitmap_test, function_bitmap_max_test) {
4340 std::string func_name = " bitmap_max" ;
4441 InputTypeSet input_types = {TypeIndex::BitMap};
4542
46- auto bitmap1 = new BitmapValue (1 );
47- auto bitmap2 = new BitmapValue (std::vector< uint64_t >( {1 , 9999999 }) );
48- auto empty_bitmap = new BitmapValue () ;
49- DataSet data_set = {{{bitmap1}, (int64_t )1 },
50- {{bitmap2}, (int64_t )9999999 },
51- {{empty_bitmap}, Null ()},
43+ BitmapValue bitmap1 (1 );
44+ BitmapValue bitmap2 ( {1 , 9999999 });
45+ BitmapValue empty_bitmap;
46+ DataSet data_set = {{{& bitmap1}, (int64_t )1 },
47+ {{& bitmap2}, (int64_t )9999999 },
48+ {{& empty_bitmap}, Null ()},
5249 {{Null ()}, Null ()}};
5350
5451 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
55- delete bitmap1;
56- delete bitmap2;
57- delete empty_bitmap;
5852}
5953
6054TEST (function_bitmap_test, function_bitmap_to_string_test) {
6155 std::string func_name = " bitmap_to_string" ;
6256 InputTypeSet input_types = {TypeIndex::BitMap};
6357
64- auto bitmap1 = new BitmapValue (1 );
65- auto bitmap2 = new BitmapValue (std::vector< uint64_t >( {1 , 9999999 }) );
66- auto empty_bitmap = new BitmapValue () ;
67- DataSet data_set = {{{bitmap1}, std::string (" 1" )},
68- {{bitmap2}, std::string (" 1,9999999" )},
69- {{empty_bitmap}, std::string (" " )},
58+ BitmapValue bitmap1 (1 );
59+ BitmapValue bitmap2 ( {1 , 9999999 });
60+ BitmapValue empty_bitmap;
61+ DataSet data_set = {{{& bitmap1}, std::string (" 1" )},
62+ {{& bitmap2}, std::string (" 1,9999999" )},
63+ {{& empty_bitmap}, std::string (" " )},
7064 {{Null ()}, Null ()}};
7165
7266 check_function<DataTypeString, true >(func_name, input_types, data_set);
73- delete bitmap1;
74- delete bitmap2;
75- delete empty_bitmap;
7667}
7768
7869TEST (function_bitmap_test, function_bitmap_and_count) {
7970 std::string func_name = " bitmap_and_count" ;
8071 InputTypeSet input_types = {TypeIndex::BitMap, TypeIndex::BitMap};
81- auto bitmap1 = new BitmapValue (std::vector< uint64_t >( {1 , 2 , 3 }) );
82- auto bitmap2 = new BitmapValue (std::vector< uint64_t >( {3 , 4 , 5 }) );
83- auto empty_bitmap = new BitmapValue () ;
84- DataSet data_set = {{{bitmap1, empty_bitmap}, (int64_t )0 },
85- {{bitmap1, bitmap1}, (int64_t )3 },
86- {{bitmap1, bitmap2}, (int64_t )1 }};
72+ BitmapValue bitmap1 ( {1 , 2 , 3 });
73+ BitmapValue bitmap2 ( {3 , 4 , 5 });
74+ BitmapValue empty_bitmap;
75+ DataSet data_set = {{{& bitmap1, & empty_bitmap}, (int64_t )0 },
76+ {{& bitmap1, & bitmap1}, (int64_t )3 },
77+ {{& bitmap1, & bitmap2}, (int64_t )1 }};
8778
8879 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
89- delete bitmap1;
90- delete bitmap2;
91- delete empty_bitmap;
9280
9381 {
9482 InputTypeSet input_types = {TypeIndex::BitMap, TypeIndex::BitMap, TypeIndex::BitMap};
9583 BitmapValue bitmap1 ({33 , 1 , 2019 });
9684 BitmapValue bitmap2 ({0 , 33 , std::numeric_limits<uint64_t >::min ()});
9785 BitmapValue bitmap3 ({33 , 5 , std::numeric_limits<uint64_t >::max ()});
98- auto empty_bitmap = new BitmapValue () ; // test empty
86+ BitmapValue empty_bitmap; // test empty
9987
100- DataSet data_set = {{{&bitmap1, &bitmap2, empty_bitmap}, (int64_t )0 },
88+ DataSet data_set = {{{&bitmap1, &bitmap2, & empty_bitmap}, (int64_t )0 },
10189 {{&bitmap1, &bitmap2, &bitmap3}, (int64_t )1 }, // 33
10290 {{&bitmap1, &bitmap2, Null ()}, Null ()},
10391 {{&bitmap1, &bitmap3, &bitmap3}, (int64_t )1 }}; // 33
10492
10593 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
106- delete empty_bitmap;
10794 }
10895}
10996
11097TEST (function_bitmap_test, function_bitmap_or_count) {
11198 std::string func_name = " bitmap_or_count" ;
11299 InputTypeSet input_types = {TypeIndex::BitMap, TypeIndex::BitMap};
113- auto bitmap1 = new BitmapValue (std::vector<uint64_t >({1 , 2 , 3 }));
114- auto bitmap2 = new BitmapValue (std::vector<uint64_t >({1 , 2 , 3 , 4 }));
115- auto bitmap3 = new BitmapValue (std::vector<uint64_t >({2 , 3 }));
116- auto empty_bitmap = new BitmapValue ();
117- DataSet data_set = {{{bitmap1, empty_bitmap}, (int64_t )3 },
118- {{bitmap2, bitmap3}, (int64_t )4 },
119- {{bitmap1, bitmap3}, (int64_t )3 }};
100+
101+ BitmapValue bitmap1 ({1 , 2 , 3 });
102+ BitmapValue bitmap2 ({1 , 2 , 3 , 4 });
103+ BitmapValue bitmap3 ({2 , 3 });
104+ BitmapValue empty_bitmap;
105+ DataSet data_set = {{{&bitmap1, &empty_bitmap}, (int64_t )3 },
106+ {{&bitmap2, &bitmap3}, (int64_t )4 },
107+ {{&bitmap1, &bitmap3}, (int64_t )3 }};
120108
121109 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
122- delete bitmap1;
123- delete bitmap2;
124- delete bitmap3;
125- delete empty_bitmap;
126110
127111 {
128112 InputTypeSet input_types = {TypeIndex::BitMap, TypeIndex::BitMap, TypeIndex::BitMap};
129113 BitmapValue bitmap1 ({1024 , 1 , 2019 });
130114 BitmapValue bitmap2 ({0 , 33 , std::numeric_limits<uint64_t >::min ()});
131115 BitmapValue bitmap3 ({33 , 5 , std::numeric_limits<uint64_t >::max ()}); // 18446744073709551615
132- auto empty_bitmap = new BitmapValue (); // test empty
116+ BitmapValue empty_bitmap; // test empty
133117
134- DataSet data_set = {{{&bitmap1, &bitmap2, empty_bitmap}, (int64_t )5 }, // 0,1,33,1024,2019
118+ DataSet data_set = {{{&bitmap1, &bitmap2, & empty_bitmap}, (int64_t )5 }, // 0,1,33,1024,2019
135119 {{&bitmap1, &bitmap2, &bitmap3},
136120 (int64_t )7 }, // 0,1,5,33,1024,2019,18446744073709551615
137- {{&bitmap1, empty_bitmap, Null ()}, Null ()},
121+ {{&bitmap1, & empty_bitmap, Null ()}, Null ()},
138122 {{&bitmap1, &bitmap3, &bitmap3},
139123 (int64_t )6 }}; // 1,5,33,1024,2019,18446744073709551615
140124
141125 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
142- delete empty_bitmap;
143126 }
144127}
145128
146129TEST (function_bitmap_test, function_bitmap_xor_count) {
147130 std::string func_name = " bitmap_xor_count" ;
148131 InputTypeSet input_types = {TypeIndex::BitMap, TypeIndex::BitMap};
149- auto bitmap1 = new BitmapValue (std::vector<uint64_t >({1 , 2 , 3 }));
150- auto bitmap2 = new BitmapValue (std::vector<uint64_t >({1 , 2 , 3 , 4 }));
151- auto bitmap3 = new BitmapValue (std::vector<uint64_t >({2 , 3 }));
152- auto bitmap4 = new BitmapValue (std::vector<uint64_t >({1 , 2 , 6 }));
153- auto empty_bitmap = new BitmapValue ();
154- DataSet data_set = {{{bitmap1, empty_bitmap}, (int64_t )3 },
155- {{bitmap2, bitmap3}, (int64_t )2 },
156- {{bitmap1, bitmap4}, (int64_t )2 }};
132+
133+ BitmapValue bitmap1 ({1 , 2 , 3 });
134+ BitmapValue bitmap2 ({1 , 2 , 3 , 4 });
135+ BitmapValue bitmap3 ({2 , 3 });
136+ BitmapValue bitmap4 ({1 , 2 , 6 });
137+ BitmapValue empty_bitmap;
138+ DataSet data_set = {{{&bitmap1, &empty_bitmap}, (int64_t )3 },
139+ {{&bitmap2, &bitmap3}, (int64_t )2 },
140+ {{&bitmap1, &bitmap4}, (int64_t )2 }};
157141
158142 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
159- delete bitmap1;
160- delete bitmap2;
161- delete bitmap3;
162- delete bitmap4;
163- delete empty_bitmap;
164143
165144 {
166145 InputTypeSet input_types = {TypeIndex::BitMap, TypeIndex::BitMap, TypeIndex::BitMap};
167146 BitmapValue bitmap1 ({1024 , 1 , 2019 });
168147 BitmapValue bitmap2 ({0 , 33 , std::numeric_limits<uint64_t >::min ()});
169148 BitmapValue bitmap3 ({33 , 5 , std::numeric_limits<uint64_t >::max ()});
170- auto empty_bitmap = new BitmapValue () ; // test empty
149+ BitmapValue empty_bitmap; // test empty
171150
172151 DataSet data_set = {
173- {{&bitmap1, &bitmap2, empty_bitmap}, (int64_t )5 }, // 0,1,33,1024,2019
152+ {{&bitmap1, &bitmap2, & empty_bitmap}, (int64_t )5 }, // 0,1,33,1024,2019
174153 {{&bitmap1, &bitmap2, &bitmap3}, (int64_t )6 }, // 0,1,5,1024,2019,18446744073709551615
175- {{&bitmap1, empty_bitmap, Null ()}, Null ()},
154+ {{&bitmap1, & empty_bitmap, Null ()}, Null ()},
176155 {{&bitmap1, &bitmap3, &bitmap3}, (int64_t )3 }}; // 1,1024,2019
177156
178157 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
179- delete empty_bitmap;
180158 }
181159}
182160
@@ -186,15 +164,14 @@ TEST(function_bitmap_test, function_bitmap_and_not_count) {
186164 BitmapValue bitmap1 ({1 , 2 , 3 });
187165 BitmapValue bitmap2 ({3 , 4 , std::numeric_limits<uint64_t >::min ()});
188166 BitmapValue bitmap3 ({33 , 5 , std::numeric_limits<uint64_t >::max ()});
189- auto empty_bitmap = new BitmapValue () ;
167+ BitmapValue empty_bitmap;
190168
191- DataSet data_set = {{{&bitmap1, empty_bitmap}, (int64_t )3 }, // 1,2,3
169+ DataSet data_set = {{{&bitmap1, & empty_bitmap}, (int64_t )3 }, // 1,2,3
192170 {{&bitmap2, Null ()}, Null ()},
193171 {{&bitmap2, &bitmap3}, (int64_t )3 }, // 0,3,4
194172 {{&bitmap1, &bitmap2}, (int64_t )2 }}; // 1,2
195173
196174 check_function<DataTypeInt64, true >(func_name, input_types, data_set);
197- delete empty_bitmap;
198175}
199176TEST (function_bitmap_test, function_bitmap_has_all) {
200177 std::string func_name = " bitmap_has_all" ;
@@ -207,18 +184,16 @@ TEST(function_bitmap_test, function_bitmap_has_all) {
207184 BitmapValue bitmap3 = BitmapValue ({0 , 1 , 2 });
208185 BitmapValue bitmap4 = BitmapValue ({0 , 1 , 2 , std::numeric_limits<uint64_t >::max ()});
209186 BitmapValue bitmap5 = BitmapValue ({0 , 1 , 2 });
210- auto empty_bitmap1 = new BitmapValue () ;
211- auto empty_bitmap2 = new BitmapValue () ;
187+ BitmapValue empty_bitmap1;
188+ BitmapValue empty_bitmap2;
212189
213190 DataSet data_set = {{{&bitmap1, &bitmap2}, uint8 (true )},
214- {{empty_bitmap1, empty_bitmap2}, uint8 (true )},
191+ {{& empty_bitmap1, & empty_bitmap2}, uint8 (true )},
215192 {{&bitmap3, &bitmap4}, uint8 (false )},
216193 {{&bitmap4, &bitmap5}, uint8 (true )},
217- {{Null (), empty_bitmap1}, Null ()}};
194+ {{Null (), & empty_bitmap1}, Null ()}};
218195
219196 check_function<DataTypeUInt8, true >(func_name, input_types, data_set);
220- delete empty_bitmap1;
221- delete empty_bitmap2;
222197}
223198
224199} // namespace doris::vectorized
0 commit comments