github-actions[bot] commented on code in PR #61946:
URL: https://github.com/apache/doris/pull/61946#discussion_r3020119793


##########
be/src/exec/operator/distinct_streaming_aggregation_operator.cpp:
##########
@@ -198,13 +194,12 @@ Status 
DistinctStreamingAggLocalState::_distinct_pre_agg_with_serialized_key(
         }
         DCHECK_EQ(out_block->columns(), key_size);
         if (_stop_emplace_flag && _distinct_row.empty()) {
-            // If _stop_emplace_flag is true and _distinct_row is also empty, 
it means it is in streaming mode, outputting what is input
-            // swap the column directly, to solve Check failed: 
d.column->use_count() == 1 (2 vs. 1)
+            // Streaming mode: move key columns directly into output block
             for (int i = 0; i < key_size; ++i) {
-                auto output_column = out_block->get_by_position(i).column;
-                out_block->replace_by_position(i, 
key_columns[i]->assume_mutable());
-                in_block->replace_by_position(result_idxs[i], output_column);
+                out_block->replace_by_position(i, 
std::move(key_column_ptrs[i]));
             }
+            // Release VSlotRef shared column references from in_block
+            in_block->clear();

Review Comment:
   `push()` here is operating on the reusable `_child_block` owned by 
`StatefulOperatorX`. Replacing the old swap-back logic with `in_block->clear()` 
changes more than reference counts: it drops the block schema entirely. On the 
next iteration, `StatefulOperatorX::get_block()` only does 
`clear_column_data(num_materialized_slots())` before reusing the same block, so 
this path can hand a structurally empty block back to the child.
   
   The previous code kept the block layout intact by swapping the original 
output columns back into `in_block`; this branch still needs to preserve that 
reusable-block contract (same issue for the other new `in_block->clear()` 
below).`



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