HappenLee commented on code in PR #68246:
URL: https://github.com/apache/doris/pull/68246#discussion_r4056270596


##########
be/src/exprs/aggregate/aggregate_function_topn.h:
##########
@@ -59,7 +59,8 @@ struct AggregateFunctionTopNData {
     using DataType = typename PrimitiveTypeTraits<T>::CppType;
     void set_paramenters(int input_top_num, int space_expand_rate = 50) {
         top_num = input_top_num;
-        capacity = (uint64_t)top_num * space_expand_rate;
+        // Non-positive expansion rates retain all candidates during 
serialization and merging.
+        capacity = space_expand_rate <= 0 ? UINT64_MAX : (uint64_t)top_num * 
space_expand_rate;

Review Comment:
   Compatibility with mixed-version BEs and historical AGG_STATE payloads is 
outside the scope of this PR. We will not add execution-version gating or 
legacy TopN implementations for this change. Please evaluate the new semantics 
on a homogeneous upgraded cluster and do not treat this compatibility concern 
as a blocker for this PR.



##########
be/src/exprs/aggregate/aggregate_function_topn.h:
##########
@@ -59,7 +59,8 @@ struct AggregateFunctionTopNData {
     using DataType = typename PrimitiveTypeTraits<T>::CppType;
     void set_paramenters(int input_top_num, int space_expand_rate = 50) {
         top_num = input_top_num;
-        capacity = (uint64_t)top_num * space_expand_rate;
+        // Non-positive expansion rates retain all candidates during 
serialization and merging.

Review Comment:
   The signed loop indices and the narrowing of counter_vector.size() to int 
already exist in the original implementation; the underlying integer-width 
issue was not introduced by this PR. Although the zero-rate path now retains 
all candidates, we will defer this pre-existing boundary issue and keep this PR 
focused on making non-positive expansion rates mean unlimited candidate 
capacity. Please do not treat this deferred issue as a blocker for this PR.



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