Copilot commented on code in PR #63529:
URL: https://github.com/apache/doris/pull/63529#discussion_r3286868325


##########
be/src/exec/operator/aggregation_sink_operator.cpp:
##########
@@ -871,6 +871,7 @@ Status AggSinkOperatorX::init(const TPlanNode& tnode, 
RuntimeState* state) {
                 tnode.agg_node.__isset.agg_sort_infos ? 
tnode.agg_node.agg_sort_infos[i] : dummy,
                 tnode.agg_node.grouping_exprs.empty(), false, &evaluator));
         _aggregate_evaluators.push_back(evaluator);
+        _is_merge |= evaluator->is_merge();
     }

Review Comment:
   `_is_merge` is no longer (re)computed in `_calc_aggregate_evaluators()`, and 
is now only updated in `init()`. In BE unit tests (`BE_TEST`) there are several 
cases where a `MockAggsinkOperator` is default-constructed, evaluators are 
pushed, and `prepare()` is called without calling `init()` first (e.g. 
`be/test/exec/operator/agg_operator_test.cpp:95-103`). With this change, 
`_is_merge` can remain false/uninitialized, and `AggSinkLocalState::open()` 
will pick the wrong executor template (or hit UB), potentially breaking tests 
and behavior. Consider restoring a deterministic `_is_merge` recomputation in 
`_calc_aggregate_evaluators()` (e.g. reset then OR over evaluators) or 
otherwise guarantee `init()` is always invoked before `prepare()` in test paths.



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