This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.2 by this push:
new 294ecd284db branch-4.2: [opt](function) reuse input column for
positive #69715 (#69792)
294ecd284db is described below
commit 294ecd284db7bef3f149bfe9b9e3f51656672d1d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Oct 29 16:33:04 2026 +0800
branch-4.2: [opt](function) reuse input column for positive #69715 (#69792)
Cherry-picked from #69715
Co-authored-by: Mryange <[email protected]>
---
be/src/exprs/function/function_unary_arithmetic.h | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/be/src/exprs/function/function_unary_arithmetic.h
b/be/src/exprs/function/function_unary_arithmetic.h
index cf7ac5dfbfb..dd28e3ac242 100644
--- a/be/src/exprs/function/function_unary_arithmetic.h
+++ b/be/src/exprs/function/function_unary_arithmetic.h
@@ -141,13 +141,19 @@ public:
} else {
if (auto col =
check_and_get_column<ColumnVector<DataType::PType>>(
block.get_by_position(arguments[0]).column.get())) {
- auto col_res =
-
PrimitiveTypeTraits<Op::ResultType>::ColumnType::create();
- auto& vec_res = col_res->get_data();
- vec_res.resize(col->get_data().size());
- UnaryOperationImpl<DataType::PType,
Op>::vector(col->get_data(),
-
vec_res);
- block.replace_by_position(result,
std::move(col_res));
+ if constexpr (std::string_view(Name::name) ==
"positive") {
+ // Positive preserves the type, so its
immutable input can be shared.
+ block.replace_by_position(
+ result,
block.get_by_position(arguments[0]).column);
+ } else {
+ auto col_res =
+
PrimitiveTypeTraits<Op::ResultType>::ColumnType::create();
+ auto& vec_res = col_res->get_data();
+ vec_res.resize(col->get_data().size());
+ UnaryOperationImpl<DataType::PType,
Op>::vector(col->get_data(),
+
vec_res);
+ block.replace_by_position(result,
std::move(col_res));
+ }
return true;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]