HappenLee commented on code in PR #50211: URL: https://github.com/apache/doris/pull/50211#discussion_r2052221959
########## be/src/pipeline/exec/streaming_aggregation_operator.cpp: ########## @@ -131,61 +131,44 @@ Status StreamingAggLocalState::open(RuntimeState* state) { evaluator->set_timer(_merge_timer, _expr_timer); } - if (_probe_expr_ctxs.empty()) { - _agg_data->without_key = reinterpret_cast<vectorized::AggregateDataPtr>( - _agg_profile_arena->alloc(p._total_size_of_aggregate_states)); + DCHECK(!_probe_expr_ctxs.empty()); - if (p._is_merge) { - if (p._needs_finalize) { - _executor = std::make_unique<Executor<true, true, true>>(); - } else { - _executor = std::make_unique<Executor<true, true, false>>(); - } + RETURN_IF_ERROR(_init_hash_method(_probe_expr_ctxs)); + + std::visit(vectorized::Overload { + [&](std::monostate& arg) -> void { + throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); + }, + [&](auto& agg_method) { + using HashTableType = std::decay_t<decltype(agg_method)>; + using KeyType = typename HashTableType::Key; + + /// some aggregate functions (like AVG for decimal) have align issues. + _aggregate_data_container = std::make_unique<AggregateDataContainer>( + sizeof(KeyType), ((p._total_size_of_aggregate_states + + p._align_aggregate_states - 1) / + p._align_aggregate_states) * + p._align_aggregate_states); + }}, + _agg_data->method_variant); + if (p._is_merge) { + if (p._needs_finalize) { Review Comment: the stream agg not need finalize. maybe add check in construct and remove the code -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org