github-actions[bot] commented on code in PR #68219:
URL: https://github.com/apache/doris/pull/68219#discussion_r4052727433


##########
be/src/exprs/aggregate/aggregate_function_bitmap_agg.h:
##########
@@ -96,17 +101,31 @@ class AggregateFunctionBitmapAgg final
                     assert_cast<const ColumnNullable&, 
TypeCheckOnRelease::DISABLE>(*columns[0]);
             const auto& column = assert_cast<const ColVecType&, 
TypeCheckOnRelease::DISABLE>(
                     nullable_column.get_nested_column());
-            std::vector<typename PrimitiveTypeTraits<T>::CppType> values;
-            for (int i = 0; i < batch_size; ++i) {
-                if (!nullable_column.is_null_at(i)) {
+            PaddedPODArray<typename PrimitiveTypeTraits<T>::CppType> values;
+            values.reserve(batch_size);
+            for (size_t i = 0; i < batch_size; ++i) {

Review Comment:
   [P2] Avoid reserving a full batch before filtering
   
   Both filtered branches reserve `batch_size` before knowing whether any row 
survives. For an all-NULL or all-negative block, `values` stays empty and 
`add_many(..., 0)` immediately returns, so a global `bitmap_agg` now allocates 
and frees a block-sized scratch buffer for every input block; sparse nullable 
blocks also allocate for all rows rather than survivors. The previous nullable 
`std::vector` grew lazily and allocated nothing for all-NULL blocks. Please 
defer or size the tracked allocation from the surviving rows while retaining 
the direct all-nonnegative fast path.



-- 
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]

Reply via email to