github-actions[bot] commented on code in PR #64120:
URL: https://github.com/apache/doris/pull/64120#discussion_r3357091820
##########
be/src/core/column/column_nullable.cpp:
##########
@@ -703,6 +704,22 @@ ColumnPtr make_nullable(const ColumnPtr& column, bool
is_nullable) {
return ColumnNullable::create(column, ColumnUInt8::create(column->size(),
is_nullable ? 1 : 0));
}
+MutableColumnPtr make_nullable(MutableColumnPtr&& column, bool is_nullable) {
+ if (is_column_nullable(*column)) {
+ return column;
+ }
+
+ if (is_column_const(*column)) {
+ return ColumnConst::create(
+ make_nullable(assert_cast<const
ColumnConst&>(*column).get_data_column_ptr(),
+ is_nullable),
+ column->size());
+ }
+
Review Comment:
This call both moves `column` and reads `column->size()` in separate
function arguments. The argument evaluation order is not guaranteed, so the
move can be evaluated first and leave the later `column->size()` dereferencing
a moved-from/null pointer. Capture `const auto size = column->size();` before
the move and use `size` when creating the null map.
##########
be/src/core/column/column_nullable.cpp:
##########
@@ -703,6 +704,22 @@ ColumnPtr make_nullable(const ColumnPtr& column, bool
is_nullable) {
return ColumnNullable::create(column, ColumnUInt8::create(column->size(),
is_nullable ? 1 : 0));
}
+MutableColumnPtr make_nullable(MutableColumnPtr&& column, bool is_nullable) {
+ if (is_column_nullable(*column)) {
Review Comment:
This new overload will not compile for an already-nullable mutable column.
`column` is a named rvalue-reference parameter, so it is an lvalue here, while
`MutableColumnPtr` is move-only (`mutable_ptr(const mutable_ptr&) = delete`).
Return it with `std::move(column)` in this branch.
--
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]