HappenLee commented on code in PR #32063: URL: https://github.com/apache/doris/pull/32063#discussion_r1522414045
########## be/src/vec/exec/distinct_vaggregation_node.cpp: ########## @@ -57,24 +59,40 @@ Status DistinctAggregationNode::_distinct_pre_agg_with_serialized_key( RETURN_IF_CATCH_EXCEPTION( _emplace_into_hash_table_to_distinct(_distinct_row, key_columns, rows)); - + // if get stop_emplace_flag = true, means have no need to emplace value into hash table + // so return block directly and notice the column ref is 2, need deal with. SCOPED_TIMER(_insert_keys_to_column_timer); bool mem_reuse = _make_nullable_keys.empty() && out_block->mem_reuse(); if (mem_reuse) { for (int i = 0; i < key_size; ++i) { - auto dst = out_block->get_by_position(i).column->assume_mutable(); - key_columns[i]->append_data_by_selector(dst, _distinct_row); + auto output_column = out_block->get_by_position(i).column; + if (_stop_emplace_flag) { // swap the column directly, to solve Check failed: d.column->use_count() == 1 (2 vs. 1) + out_block->replace_by_position(i, key_columns[i]->assume_mutable()); + in_block->replace_by_position(result_idxs[i], output_column); Review Comment: `clone_reisze()` or `insert_range_from()` -- 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