github-actions[bot] commented on code in PR #63001:
URL: https://github.com/apache/doris/pull/63001#discussion_r3220473784
##########
be/src/core/block/block.cpp:
##########
@@ -655,9 +655,26 @@ void Block::clear_column_data(int64_t column_size)
noexcept {
}
for (auto& d : data) {
if (d.column) {
- // Temporarily disable reference count check because a column
might be referenced multiple times within a block.
- // Queries like this: `select c, c from t1;`
- (*std::move(d.column)).assume_mutable()->clear();
+ if (d.column->is_exclusive()) {
+ d.column->assume_mutable()->clear();
+ } else {
+ d.column = d.column->clone_empty();
+ }
+ }
+ }
+}
Review Comment:
Changing `mutate_columns()` from `(*std::move(data[i].column)).mutate()` to
`IColumn::mutate(std::move(data[i].column))` makes this API actually steal
every column out of the `Block`; the previous expression did not move the
`ColumnPtr` out of `data`. That means every caller must restore with
`set_columns()` on all exits, but several current callers still have
`RETURN_IF_ERROR`/error returns between `mutate_columns()` and `set_columns()`
(for example `ArrowStreamReader::_do_get_next_block`,
`CsvReader::_do_get_next_block`, `RemoteDorisReader::_do_get_next_block`, and
the local exchanger `get_block()` paths). If conversion/add_rows fails, the
caller receives a non-OK status with the output `Block` left with
moved-from/null columns, so later cleanup, logging, reuse, or retry can crash
or observe corrupted block state. Please either preserve the old non-stealing
semantics here or make the affected callers restore the columns with
RAII/`Defer` before any error-producing work can retur
n.
--
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]