BiteTheDDDDt commented on code in PR #32760:
URL: https://github.com/apache/doris/pull/32760#discussion_r1538501119


##########
be/src/vec/exec/distinct_vaggregation_node.cpp:
##########
@@ -64,14 +65,25 @@ Status 
DistinctAggregationNode::_distinct_pre_agg_with_serialized_key(
     SCOPED_TIMER(_insert_keys_to_column_timer);
     bool mem_reuse = _make_nullable_keys.empty() && out_block->mem_reuse();
     if (mem_reuse) {
+        auto insert_data_with_selector = [&](ColumnPtr output_column, int idx) 
{
+            auto dst = output_column->assume_mutable();
+            key_columns[idx]->append_data_by_selector(dst, _distinct_row);
+        };
         for (int i = 0; i < key_size; ++i) {
             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)
+            if (_stop_emplace_flag && !out_block->empty()) {
+                // when out_block row >= batch_size, push it to data_queue, so 
when _stop_emplace_flag = true, maybe have some data in block
+                // need output those data firstly
+                for (int i = 0; i < rows; ++i) {
+                    _distinct_row.push_back(i);

Review Comment:
   Will _distinct_row be pushed back multiple times?



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