This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7545c5e6a59 [chore](status) remove static_cast<void> in vec/functions
(#51545)
7545c5e6a59 is described below
commit 7545c5e6a59409a8d5e959ba4b2a9c2dd7448c4b
Author: Mryange <[email protected]>
AuthorDate: Sat Jun 7 09:48:42 2025 +0800
[chore](status) remove static_cast<void> in vec/functions (#51545)
---
be/src/vec/functions/function_rpc.cpp | 7 ++---
be/src/vec/functions/function_rpc.h | 2 +-
be/src/vec/functions/function_string.cpp | 21 ++++++++-------
be/src/vec/functions/function_string_to_string.h | 4 +--
be/src/vec/functions/function_totype.h | 34 +++++++++++++-----------
be/src/vec/functions/url/functions_url.h | 5 ++--
6 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/be/src/vec/functions/function_rpc.cpp
b/be/src/vec/functions/function_rpc.cpp
index d88266cc2bf..f8e77f7607c 100644
--- a/be/src/vec/functions/function_rpc.cpp
+++ b/be/src/vec/functions/function_rpc.cpp
@@ -67,7 +67,7 @@ Status RPCFnImpl::vec_call(FunctionContext* context, Block&
block, const ColumnN
return Status::InternalError("call to rpc function {} failed: {}",
_signature,
response.status().DebugString());
}
- _convert_to_block(block, response.result(0), result);
+ RETURN_IF_ERROR(_convert_to_block(block, response.result(0), result));
return Status::OK();
}
@@ -84,12 +84,13 @@ Status RPCFnImpl::_convert_block_to_proto(Block& block,
const ColumnNumbers& arg
return Status::OK();
}
-void RPCFnImpl::_convert_to_block(Block& block, const PValues& result, size_t
pos) {
+Status RPCFnImpl::_convert_to_block(Block& block, const PValues& result,
size_t pos) {
auto data_type = block.get_data_type(pos);
auto col = data_type->create_column();
auto serde = data_type->get_serde();
- static_cast<void>(serde->read_column_from_pb(*col, result));
+ RETURN_IF_ERROR(serde->read_column_from_pb(*col, result));
block.replace_by_position(pos, std::move(col));
+ return Status::OK();
}
FunctionRPC::FunctionRPC(const TFunction& fn, const DataTypes& argument_types,
diff --git a/be/src/vec/functions/function_rpc.h
b/be/src/vec/functions/function_rpc.h
index fd17577ddad..97c769e8bfc 100644
--- a/be/src/vec/functions/function_rpc.h
+++ b/be/src/vec/functions/function_rpc.h
@@ -55,7 +55,7 @@ private:
Status _convert_block_to_proto(vectorized::Block& block,
const vectorized::ColumnNumbers& arguments,
size_t input_rows_count,
PFunctionCallRequest* request);
- void _convert_to_block(vectorized::Block& block, const PValues& result,
size_t pos);
+ Status _convert_to_block(vectorized::Block& block, const PValues& result,
size_t pos);
std::shared_ptr<PFunctionService_Stub> _client;
std::string _function_name;
diff --git a/be/src/vec/functions/function_string.cpp
b/be/src/vec/functions/function_string.cpp
index f3b73d51a83..a0abf4cf80a 100644
--- a/be/src/vec/functions/function_string.cpp
+++ b/be/src/vec/functions/function_string.cpp
@@ -386,10 +386,10 @@ struct StringFunctionImpl {
using ResultDataType = typename OP::ResultDataType;
using ResultPaddedPODArray = typename OP::ResultPaddedPODArray;
- static void vector_vector(const ColumnString::Chars& ldata,
- const ColumnString::Offsets& loffsets,
- const ColumnString::Chars& rdata,
- const ColumnString::Offsets& roffsets,
ResultPaddedPODArray& res) {
+ static Status vector_vector(const ColumnString::Chars& ldata,
+ const ColumnString::Offsets& loffsets,
+ const ColumnString::Chars& rdata,
+ const ColumnString::Offsets& roffsets,
ResultPaddedPODArray& res) {
DCHECK_EQ(loffsets.size(), roffsets.size());
auto size = loffsets.size();
@@ -406,10 +406,11 @@ struct StringFunctionImpl {
OP::execute(lview, rview, res[i]);
}
+ return Status::OK();
}
- static void vector_scalar(const ColumnString::Chars& ldata,
- const ColumnString::Offsets& loffsets, const
StringRef& rdata,
- ResultPaddedPODArray& res) {
+ static Status vector_scalar(const ColumnString::Chars& ldata,
+ const ColumnString::Offsets& loffsets, const
StringRef& rdata,
+ ResultPaddedPODArray& res) {
auto size = loffsets.size();
res.resize(size);
std::string_view rview(rdata.data, rdata.size);
@@ -420,9 +421,10 @@ struct StringFunctionImpl {
OP::execute(lview, rview, res[i]);
}
+ return Status::OK();
}
- static void scalar_vector(const StringRef& ldata, const
ColumnString::Chars& rdata,
- const ColumnString::Offsets& roffsets,
ResultPaddedPODArray& res) {
+ static Status scalar_vector(const StringRef& ldata, const
ColumnString::Chars& rdata,
+ const ColumnString::Offsets& roffsets,
ResultPaddedPODArray& res) {
auto size = roffsets.size();
res.resize(size);
std::string_view lview(ldata.data, ldata.size);
@@ -433,6 +435,7 @@ struct StringFunctionImpl {
OP::execute(lview, rview, res[i]);
}
+ return Status::OK();
}
};
diff --git a/be/src/vec/functions/function_string_to_string.h
b/be/src/vec/functions/function_string_to_string.h
index 8f7bce1edb3..e167bc3a4fb 100644
--- a/be/src/vec/functions/function_string_to_string.h
+++ b/be/src/vec/functions/function_string_to_string.h
@@ -64,8 +64,8 @@ public:
const ColumnPtr column = block.get_by_position(arguments[0]).column;
if (const auto* col =
check_and_get_column<ColumnString>(column.get())) {
auto col_res = ColumnString::create();
- static_cast<void>(Impl::vector(col->get_chars(),
col->get_offsets(),
- col_res->get_chars(),
col_res->get_offsets()));
+ RETURN_IF_ERROR(Impl::vector(col->get_chars(), col->get_offsets(),
col_res->get_chars(),
+ col_res->get_offsets()));
block.replace_by_position(result, std::move(col_res));
} else {
return Status::RuntimeError("Illegal column {} of argument of
function {}",
diff --git a/be/src/vec/functions/function_totype.h
b/be/src/vec/functions/function_totype.h
index efa9d46874f..714d2fd1661 100644
--- a/be/src/vec/functions/function_totype.h
+++ b/be/src/vec/functions/function_totype.h
@@ -236,20 +236,23 @@ private:
auto& vec_res = col_res->get_data();
vec_res.resize(block.rows());
- if (auto col_left = check_and_get_column<ColVecLeft>(lcol.get())) {
- if (auto col_right =
check_and_get_column<ColVecRight>(rcol.get())) {
+ if (const auto* col_left =
check_and_get_column<ColVecLeft>(lcol.get())) {
+ if (const auto* col_right =
check_and_get_column<ColVecRight>(rcol.get())) {
if (left_const) {
- static_cast<void>(Impl<LeftDataType,
RightDataType>::scalar_vector(
+ auto st = Impl<LeftDataType, RightDataType>::scalar_vector(
col_left->get_data_at(0), col_right->get_chars(),
- col_right->get_offsets(), vec_res));
+ col_right->get_offsets(), vec_res);
+ RETURN_IF_ERROR(st);
} else if (right_const) {
- static_cast<void>(Impl<LeftDataType,
RightDataType>::vector_scalar(
+ auto st = Impl<LeftDataType, RightDataType>::vector_scalar(
col_left->get_chars(), col_left->get_offsets(),
- col_right->get_data_at(0), vec_res));
+ col_right->get_data_at(0), vec_res);
+ RETURN_IF_ERROR(st);
} else {
- static_cast<void>(Impl<LeftDataType,
RightDataType>::vector_vector(
+ auto st = Impl<LeftDataType, RightDataType>::vector_vector(
col_left->get_chars(), col_left->get_offsets(),
col_right->get_chars(),
- col_right->get_offsets(), vec_res));
+ col_right->get_offsets(), vec_res);
+ RETURN_IF_ERROR(st);
}
block.replace_by_position(result, std::move(col_res));
@@ -465,9 +468,8 @@ public:
auto res = Impl::ColumnType::create();
if (const auto* col =
check_and_get_column<ColumnString>(col_ptr.get())) {
auto col_res = Impl::ColumnType::create();
- static_cast<void>(Impl::vector(col->get_chars(),
col->get_offsets(),
- col_res->get_chars(),
col_res->get_offsets(),
- null_map->get_data()));
+ RETURN_IF_ERROR(Impl::vector(col->get_chars(), col->get_offsets(),
col_res->get_chars(),
+ col_res->get_offsets(),
null_map->get_data()));
block.replace_by_position(
result, ColumnNullable::create(std::move(col_res),
std::move(null_map)));
} else {
@@ -506,9 +508,9 @@ public:
auto& null_map_data = null_map->get_data();
if (const auto* col = assert_cast<const
ColumnString*>(col_ptr.get())) {
auto col_res = Impl::ColumnType::create();
- static_cast<void>(Impl::vector(col->get_chars(),
col->get_offsets(),
- col_res->get_chars(),
col_res->get_offsets(),
- &null_map_data));
+ RETURN_IF_ERROR(Impl::vector(col->get_chars(),
col->get_offsets(),
+ col_res->get_chars(),
col_res->get_offsets(),
+ &null_map_data));
block.get_by_position(result).column =
ColumnNullable::create(std::move(col_res),
std::move(null_map));
} else {
@@ -519,8 +521,8 @@ public:
} else {
if (const auto* col = assert_cast<const
ColumnString*>(col_ptr.get())) {
auto col_res = Impl::ColumnType::create();
- static_cast<void>(Impl::vector(col->get_chars(),
col->get_offsets(),
- col_res->get_chars(),
col_res->get_offsets()));
+ RETURN_IF_ERROR(Impl::vector(col->get_chars(),
col->get_offsets(),
+ col_res->get_chars(),
col_res->get_offsets()));
block.replace_by_position(result, std::move(col_res));
} else {
return Status::RuntimeError("Illegal column {} of argument of
function {}",
diff --git a/be/src/vec/functions/url/functions_url.h
b/be/src/vec/functions/url/functions_url.h
index b6736496d24..dce42d4044e 100644
--- a/be/src/vec/functions/url/functions_url.h
+++ b/be/src/vec/functions/url/functions_url.h
@@ -73,8 +73,8 @@ using Pos = const char*;
*/
template <typename Extractor>
struct ExtractSubstringImpl {
- static void vector(const ColumnString::Chars& data, const
ColumnString::Offsets& offsets,
- ColumnString::Chars& res_data, ColumnString::Offsets&
res_offsets) {
+ static Status vector(const ColumnString::Chars& data, const
ColumnString::Offsets& offsets,
+ ColumnString::Chars& res_data, ColumnString::Offsets&
res_offsets) {
size_t size = offsets.size();
res_offsets.resize(size);
res_data.reserve(size * Extractor::get_reserve_length_for_element());
@@ -96,6 +96,7 @@ struct ExtractSubstringImpl {
res_offsets[i] = res_offset;
prev_offset = offsets[i];
}
+ return Status::OK();
}
static void constant(const std::string& data, std::string& res_data) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]