Skip to content

Commit

Permalink
other functions
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangstar333 committed Jan 11, 2024
1 parent 3c2a33c commit 5edde0e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 26 deletions.
4 changes: 2 additions & 2 deletions be/src/vec/functions/function_bitmap_variadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ class FunctionBitMapVariadic : public IFunction {
auto& vec_res = col_res->get_data();
vec_res.resize(input_rows_count);

static_cast<void>(Impl::vector_vector(argument_columns, argument_size, input_rows_count,
vec_res, col_res_nulls));
RETURN_IF_ERROR(Impl::vector_vector(argument_columns, argument_size, input_rows_count,
vec_res, col_res_nulls));
if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) {
block.replace_by_position(
result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls)));
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/functions/function_coalesce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class FunctionCoalesce : public IFunction {
for (size_t i = 0; i < argument_size && remaining_rows; ++i) {
temporary_block.get_by_position(0).column =
block.get_by_position(filtered_args[i]).column;
static_cast<void>(
RETURN_IF_ERROR(
func_is_not_null->execute(context, temporary_block, {0}, 1, input_rows_count));

auto res_column =
Expand Down
5 changes: 2 additions & 3 deletions be/src/vec/functions/function_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ class FunctionEncryptionAndDecrypt : public IFunction {
chars_list[i] = &col_str->get_chars();
}

static_cast<void>(Impl::vector_vector(offsets_list, chars_list, input_rows_count,
result_data, result_offset,
result_null_map->get_data()));
RETURN_IF_ERROR(Impl::vector_vector(offsets_list, chars_list, input_rows_count, result_data,
result_offset, result_null_map->get_data()));
block.get_by_position(result).column =
ColumnNullable::create(std::move(result_data_column), std::move(result_null_map));
return Status::OK();
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/functions/function_hex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class FunctionHexVariadic : public IFunction {
auto& result_data = result_data_column->get_chars();
auto& result_offset = result_data_column->get_offsets();

static_cast<void>(
RETURN_IF_ERROR(
Impl::vector(argument_column, input_rows_count, result_data, result_offset));
block.replace_by_position(result, std::move(result_data_column));
return Status::OK();
Expand Down
3 changes: 1 addition & 2 deletions be/src/vec/functions/function_ifnull.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ class FunctionIfNull : public IFunction {

auto func_if = SimpleFunctionFactory::instance().get_function(
"if", if_columns, block.get_by_position(result).type);
static_cast<void>(
func_if->execute(context, temporary_block, {0, 1, 2}, 3, input_rows_count));
RETURN_IF_ERROR(func_if->execute(context, temporary_block, {0, 1, 2}, 3, input_rows_count));
block.get_by_position(result).column = temporary_block.get_by_position(3).column;
return Status::OK();
}
Expand Down
6 changes: 2 additions & 4 deletions be/src/vec/functions/function_quantile_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,9 @@ class FunctionToQuantileState : public IFunction {
const DataTypePtr& nested_data_type =
static_cast<const DataTypeNullable*>(data_type.get())->get_nested_type();
WhichDataType nested_which(nested_data_type);
static_cast<void>(
execute_internal<true>(column, data_type, column_result, compression));
RETURN_IF_ERROR(execute_internal<true>(column, data_type, column_result, compression));
} else {
static_cast<void>(
execute_internal<false>(column, data_type, column_result, compression));
RETURN_IF_ERROR(execute_internal<false>(column, data_type, column_result, compression));
}
if (status.ok()) {
block.replace_by_position(result, std::move(column_result));
Expand Down
5 changes: 2 additions & 3 deletions be/src/vec/functions/function_reverse.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ class FunctionReverseCommon : public IFunction {
ColumnPtr& src_column = block.get_by_position(arguments[0]).column;
if (const ColumnString* col_string = check_and_get_column<ColumnString>(src_column.get())) {
auto col_res = ColumnString::create();
static_cast<void>(ReverseImpl::vector(col_string->get_chars(),
col_string->get_offsets(), col_res->get_chars(),
col_res->get_offsets()));
RETURN_IF_ERROR(ReverseImpl::vector(col_string->get_chars(), col_string->get_offsets(),
col_res->get_chars(), col_res->get_offsets()));
block.replace_by_position(result, std::move(col_res));
} else if (check_column<ColumnArray>(src_column.get())) {
return ArrayReverseImpl::_execute(block, arguments, result, input_rows_count);
Expand Down
11 changes: 6 additions & 5 deletions be/src/vec/functions/function_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <string_view>

#include "common/status.h"
#include "runtime/string_search.hpp"
#include "util/url_coding.h"
#include "vec/columns/column_string.h"
Expand Down Expand Up @@ -492,13 +493,13 @@ struct Trim1Impl {
static Status execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) {
const ColumnPtr column = block.get_by_position(arguments[0]).column;
if (auto col = assert_cast<const ColumnString*>(column.get())) {
if (const auto* col = assert_cast<const ColumnString*>(column.get())) {
auto col_res = ColumnString::create();
char blank[] = " ";
StringRef rhs(blank, 1);
static_cast<void>(TrimUtil<is_ltrim, is_rtrim>::vector(
RETURN_IF_ERROR((TrimUtil<is_ltrim, is_rtrim>::vector(
col->get_chars(), col->get_offsets(), rhs, col_res->get_chars(),
col_res->get_offsets()));
col_res->get_offsets())));
block.replace_by_position(result, std::move(col_res));
} else {
return Status::RuntimeError("Illegal column {} of argument of function {}",
Expand Down Expand Up @@ -530,9 +531,9 @@ struct Trim2Impl {
const char* raw_rhs = reinterpret_cast<const char*>(&(col_right->get_chars()[0]));
ColumnString::Offset rhs_size = col_right->get_offsets()[0];
StringRef rhs(raw_rhs, rhs_size);
static_cast<void>(TrimUtil<is_ltrim, is_rtrim>::vector(
RETURN_IF_ERROR((TrimUtil<is_ltrim, is_rtrim>::vector(
col->get_chars(), col->get_offsets(), rhs, col_res->get_chars(),
col_res->get_offsets()));
col_res->get_offsets())));
block.replace_by_position(result, std::move(col_res));
} else {
return Status::RuntimeError("Illegal column {} of argument of function {}",
Expand Down
8 changes: 4 additions & 4 deletions be/src/vec/functions/function_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ class FunctionNullOrEmpty : public IFunction {

Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override {
static_cast<void>(NullOrEmptyImpl::execute(context, block, arguments, result,
input_rows_count, false));
RETURN_IF_ERROR(NullOrEmptyImpl::execute(context, block, arguments, result,
input_rows_count, false));
return Status::OK();
}
};
Expand All @@ -714,8 +714,8 @@ class FunctionNotNullOrEmpty : public IFunction {

Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override {
static_cast<void>(NullOrEmptyImpl::execute(context, block, arguments, result,
input_rows_count, true));
RETURN_IF_ERROR(NullOrEmptyImpl::execute(context, block, arguments, result,
input_rows_count, true));
return Status::OK();
}
};
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/functions/like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Status FunctionLikeBase::execute_impl(FunctionContext* context, Block& block,
for (int i = 0; i < input_rows_count; i++) {
const auto pattern_val = str_patterns->get_data_at(i);
const auto value_val = values->get_data_at(i);
static_cast<void>((state->scalar_function)(
RETURN_IF_ERROR((state->scalar_function)(
const_cast<vectorized::LikeSearchState*>(&state->search_state), value_val,
pattern_val, &vec_res[i]));
}
Expand Down

0 comments on commit 5edde0e

Please sign in to comment.