This is an automated email from the ASF dual-hosted git repository.
Mryange 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 070f12916f5 [refactor](be) Remove redundant casts from BE code (#64087)
070f12916f5 is described below
commit 070f12916f5632b114955786756f6123415d52cc
Author: Mryange <[email protected]>
AuthorDate: Tue Jun 9 18:09:33 2026 +0800
[refactor](be) Remove redundant casts from BE code (#64087)
### What problem does this PR solve?
Problem Summary: Remove redundant casts reported by clang-tidy
readability-redundant-casting in BE code. These casts were no-op
conversions to the same type, including redundant static_cast,
reinterpret_cast, and C-style casts. The change keeps casts that still
perform real type conversion and only removes the redundant outer casts
reported by clang-tidy.
### Release note
None
### Release note
None
---
be/src/core/column/column_variant.cpp | 2 +-
.../data_type/data_type_date_or_datetime_v2.cpp | 8 +++----
be/src/core/data_type/data_type_decimal.cpp | 2 +-
.../data_type_serde/data_type_decimal_serde.cpp | 4 ++--
.../core/data_type_serde/data_type_hll_serde.cpp | 2 +-
.../data_type_serde/data_type_number_serde.cpp | 2 +-
be/src/core/value/vdatetime_value.h | 5 ++---
be/src/exec/common/hex.h | 4 ++--
be/src/exec/operator/materialization_opertor.cpp | 2 +-
be/src/exprs/bloom_filter_func_adaptor.h | 2 +-
be/src/exprs/function/divide.cpp | 2 +-
be/src/exprs/function/function_conv.cpp | 4 ++--
.../function_date_or_datetime_computation.h | 2 +-
be/src/exprs/function/function_jsonb.cpp | 3 +--
be/src/exprs/function/function_string_search.cpp | 26 ++++++++--------------
be/src/format/orc/vorc_reader.cpp | 4 ++--
be/src/format/table/iceberg_reader_mixin.h | 2 +-
be/src/format/table/paimon_predicate_converter.cpp | 2 +-
be/src/format/table/transactional_hive_reader.cpp | 3 +--
be/src/io/cache/block_file_cache_factory.cpp | 6 ++---
be/src/io/cache/fs_file_cache_storage.cpp | 4 ++--
be/src/io/fs/s3_file_writer.cpp | 2 +-
be/src/load/routine_load/data_consumer.h | 2 +-
be/src/service/backend_service.cpp | 2 +-
be/src/service/point_query_executor.h | 2 +-
be/src/storage/index/ann/faiss_ann_index.cpp | 3 +--
.../token_filter/word_delimiter_iterator.cpp | 5 ++---
be/src/storage/segment/bitshuffle_page.h | 4 ++--
.../storage/segment/historical_row_retriever.cpp | 2 +-
.../segment/variant/variant_column_reader.cpp | 2 +-
be/src/storage/tablet/tablet.cpp | 4 ++--
be/src/util/jni-util.cpp | 2 +-
be/src/util/jni-util.h | 3 +--
be/src/util/url_coding.cpp | 3 +--
34 files changed, 55 insertions(+), 72 deletions(-)
diff --git a/be/src/core/column/column_variant.cpp
b/be/src/core/column/column_variant.cpp
index 88cd501acb3..ef0c6c8d9c3 100644
--- a/be/src/core/column/column_variant.cpp
+++ b/be/src/core/column/column_variant.cpp
@@ -2299,7 +2299,7 @@ void ColumnVariant::finalize(FinalizeMode mode) {
}
void ColumnVariant::finalize() {
- static_cast<void>(finalize(FinalizeMode::READ_MODE));
+ finalize(FinalizeMode::READ_MODE);
}
void ColumnVariant::ensure_root_node_type(const DataTypePtr&
expected_root_type) const {
diff --git a/be/src/core/data_type/data_type_date_or_datetime_v2.cpp
b/be/src/core/data_type/data_type_date_or_datetime_v2.cpp
index 6da080b2f1f..35b3ba7c56a 100644
--- a/be/src/core/data_type/data_type_date_or_datetime_v2.cpp
+++ b/be/src/core/data_type/data_type_date_or_datetime_v2.cpp
@@ -89,13 +89,13 @@ MutableColumnPtr DataTypeDateV2::create_column() const {
void DataTypeDateV2::cast_to_date_time(const DateV2Value<DateV2ValueType> from,
VecDateTimeValue& to) {
- auto& to_value = (VecDateTimeValue&)to;
+ auto& to_value = to;
auto& from_value = (DateV2Value<DateV2ValueType>&)from;
to_value.create_from_date_v2(from_value, TimeType::TIME_DATETIME);
}
void DataTypeDateV2::cast_to_date(const DateV2Value<DateV2ValueType> from,
VecDateTimeValue& to) {
- auto& to_value = (VecDateTimeValue&)(to);
+ auto& to_value = to;
auto& from_value = (DateV2Value<DateV2ValueType>&)from;
to_value.create_from_date_v2(from_value, TimeType::TIME_DATE);
}
@@ -137,14 +137,14 @@ MutableColumnPtr DataTypeDateTimeV2::create_column()
const {
void DataTypeDateTimeV2::cast_to_date_time(const
DateV2Value<DateTimeV2ValueType> from,
VecDateTimeValue& to) {
- auto& to_value = (VecDateTimeValue&)to;
+ auto& to_value = to;
auto& from_value = (DateV2Value<DateTimeV2ValueType>&)from;
to_value.create_from_date_v2(from_value, TimeType::TIME_DATETIME);
}
void DataTypeDateTimeV2::cast_to_date(const DateV2Value<DateTimeV2ValueType>
from,
VecDateTimeValue& to) {
- auto& to_value = (VecDateTimeValue&)(to);
+ auto& to_value = to;
auto& from_value = (DateV2Value<DateTimeV2ValueType>&)from;
to_value.create_from_date_v2(from_value, TimeType::TIME_DATE);
}
diff --git a/be/src/core/data_type/data_type_decimal.cpp
b/be/src/core/data_type/data_type_decimal.cpp
index afd2ac4449d..752275d9580 100644
--- a/be/src/core/data_type/data_type_decimal.cpp
+++ b/be/src/core/data_type/data_type_decimal.cpp
@@ -239,7 +239,7 @@ DataTypePtr create_decimal(UInt64 precision_value, UInt64
scale_value, bool use_
min_decimal_precision(), max_precision);
}
- if (static_cast<UInt64>(scale_value) > precision_value) {
+ if (scale_value > precision_value) {
throw doris::Exception(doris::ErrorCode::NOT_IMPLEMENTED_ERROR,
"Negative scales and scales larger than
precision are not "
"supported, scale_value: {}, precision_value:
{}",
diff --git a/be/src/core/data_type_serde/data_type_decimal_serde.cpp
b/be/src/core/data_type_serde/data_type_decimal_serde.cpp
index 084f9c75df3..ba1d6dd08fa 100644
--- a/be/src/core/data_type_serde/data_type_decimal_serde.cpp
+++ b/be/src/core/data_type_serde/data_type_decimal_serde.cpp
@@ -730,9 +730,9 @@ const uint8_t*
DataTypeDecimalSerDe<T>::deserialize_binary_to_column(const uint8
template <PrimitiveType T>
const uint8_t* DataTypeDecimalSerDe<T>::deserialize_binary_to_field(const
uint8_t* data,
Field&
field, FieldInfo& info) {
- const uint8_t precision = *reinterpret_cast<const uint8_t*>(data);
+ const uint8_t precision = *data;
data += sizeof(uint8_t);
- const uint8_t scale = *reinterpret_cast<const uint8_t*>(data);
+ const uint8_t scale = *data;
data += sizeof(uint8_t);
info.precision = static_cast<int>(precision);
info.scale = static_cast<int>(scale);
diff --git a/be/src/core/data_type_serde/data_type_hll_serde.cpp
b/be/src/core/data_type_serde/data_type_hll_serde.cpp
index 59218f81d74..630d42629bc 100644
--- a/be/src/core/data_type_serde/data_type_hll_serde.cpp
+++ b/be/src/core/data_type_serde/data_type_hll_serde.cpp
@@ -111,7 +111,7 @@ void DataTypeHLLSerDe::write_one_cell_to_jsonb(const
IColumn& column, JsonbWrite
const auto& data_column = assert_cast<const ColumnHLL&>(column);
auto& hll_value = data_column.get_element(row_num);
auto size = hll_value.max_serialized_size();
- auto* ptr = reinterpret_cast<char*>(arena.alloc(size));
+ auto* ptr = arena.alloc(size);
size_t actual_size = hll_value.serialize((uint8_t*)ptr);
result.writeStartBinary();
result.writeBinary(reinterpret_cast<const char*>(ptr), actual_size);
diff --git a/be/src/core/data_type_serde/data_type_number_serde.cpp
b/be/src/core/data_type_serde/data_type_number_serde.cpp
index a8e379578d0..5f518aa6bbd 100644
--- a/be/src/core/data_type_serde/data_type_number_serde.cpp
+++ b/be/src/core/data_type_serde/data_type_number_serde.cpp
@@ -1008,7 +1008,7 @@ const uint8_t*
DataTypeNumberSerDe<T>::deserialize_binary_to_field(const uint8_t
field = Field::create_field<TYPE_DATEV2>(v);
data += sizeof(UInt32);
} else if constexpr (T == TYPE_DATETIMEV2 || T == TYPE_TIMESTAMPTZ) {
- const uint8_t scale = *reinterpret_cast<const uint8_t*>(data);
+ const uint8_t scale = *data;
data += sizeof(uint8_t);
UInt64 v = unaligned_load<UInt64>(data);
info.precision = -1;
diff --git a/be/src/core/value/vdatetime_value.h
b/be/src/core/value/vdatetime_value.h
index 8d826884a24..7419b021755 100644
--- a/be/src/core/value/vdatetime_value.h
+++ b/be/src/core/value/vdatetime_value.h
@@ -691,9 +691,8 @@ public:
uint32_t to_date_v2() const { return (year() << 9 | month() << 5 | day());
}
uint64_t to_datetime_v2() const {
- return (uint64_t)(((uint64_t)year() << 46) | ((uint64_t)month() << 42)
|
- ((uint64_t)day() << 37) | ((uint64_t)hour() << 32) |
- ((uint64_t)minute() << 26) | ((uint64_t)second() <<
20));
+ return (((uint64_t)year() << 46) | ((uint64_t)month() << 42) |
((uint64_t)day() << 37) |
+ ((uint64_t)hour() << 32) | ((uint64_t)minute() << 26) |
((uint64_t)second() << 20));
}
uint32_t hash(int seed) const { return HashUtil::hash(this, sizeof(*this),
seed); }
diff --git a/be/src/exec/common/hex.h b/be/src/exec/common/hex.h
index 846eb48ba22..48e3c515331 100644
--- a/be/src/exec/common/hex.h
+++ b/be/src/exec/common/hex.h
@@ -107,7 +107,7 @@ inline UInt8 unhex(char c) {
}
inline UInt8 unhex2(const char* data) {
- return static_cast<UInt8>(unhex(data[0])) * 0x10 +
static_cast<UInt8>(unhex(data[1]));
+ return unhex(data[0]) * 0x10 + unhex(data[1]);
}
inline UInt16 unhex4(const char* data) {
@@ -132,4 +132,4 @@ TUInt unhex_uint(const char* data) {
}
return res;
}
-} // namespace doris
\ No newline at end of file
+} // namespace doris
diff --git a/be/src/exec/operator/materialization_opertor.cpp
b/be/src/exec/operator/materialization_opertor.cpp
index b8558218a4c..7ceeae0f261 100644
--- a/be/src/exec/operator/materialization_opertor.cpp
+++ b/be/src/exec/operator/materialization_opertor.cpp
@@ -405,7 +405,7 @@ Status MaterializationOperator::push(RuntimeState* state,
Block* in_block, bool
}
counter.wait();
if (auto time = rpc_timer.elapsed_time(); time >
local_state._max_rpc_timer->value()) {
- local_state._max_rpc_timer->set(static_cast<int64_t>(time));
+ local_state._max_rpc_timer->set(time);
}
for (auto& [backend_id, rpc_struct] :
local_state._materialization_state.rpc_struct_map) {
diff --git a/be/src/exprs/bloom_filter_func_adaptor.h
b/be/src/exprs/bloom_filter_func_adaptor.h
index 5cc5d33215d..119e7c2c939 100644
--- a/be/src/exprs/bloom_filter_func_adaptor.h
+++ b/be/src/exprs/bloom_filter_func_adaptor.h
@@ -50,7 +50,7 @@ public:
return _bloom_filter->init_from_directory(log_space, data, data_size,
false, 0);
}
- char* data() { return (char*)_bloom_filter->directory().data; }
+ char* data() { return _bloom_filter->directory().data; }
size_t size() { return _bloom_filter->directory().size; }
diff --git a/be/src/exprs/function/divide.cpp b/be/src/exprs/function/divide.cpp
index fe25a529e71..32dfe67ceee 100644
--- a/be/src/exprs/function/divide.cpp
+++ b/be/src/exprs/function/divide.cpp
@@ -349,7 +349,7 @@ struct DivideFloatingImpl {
static inline ArgA apply(ArgA a, ArgB b, UInt8& is_null) {
is_null = b == 0;
- return static_cast<ArgA>(a) / (b + is_null);
+ return a / (b + is_null);
}
static ColumnPtr constant_constant(ArgA a, ArgB b) {
diff --git a/be/src/exprs/function/function_conv.cpp
b/be/src/exprs/function/function_conv.cpp
index 7a309acdf82..1c4552f1d3b 100644
--- a/be/src/exprs/function/function_conv.cpp
+++ b/be/src/exprs/function/function_conv.cpp
@@ -175,7 +175,7 @@ struct ConvInt64Impl {
}
}
StringRef str = MathFunctions::decimal_to_base(context, decimal_num,
dst_base);
- result_column->insert_data(reinterpret_cast<const char*>(str.data),
str.size);
+ result_column->insert_data(str.data, str.size);
}
};
@@ -211,7 +211,7 @@ struct ConvStringImpl {
result_column->insert_data("0", 1);
} else {
StringRef str_base = MathFunctions::decimal_to_base(context,
decimal_num, dst_base);
- result_column->insert_data(reinterpret_cast<const
char*>(str_base.data), str_base.size);
+ result_column->insert_data(str_base.data, str_base.size);
}
}
};
diff --git a/be/src/exprs/function/function_date_or_datetime_computation.h
b/be/src/exprs/function/function_date_or_datetime_computation.h
index 939eade4ea4..db1bd7441fc 100644
--- a/be/src/exprs/function/function_date_or_datetime_computation.h
+++ b/be/src/exprs/function/function_date_or_datetime_computation.h
@@ -1493,7 +1493,7 @@ private:
if (UNLIKELY(dtv1.day() == days_in_month1 && dtv2.day() ==
days_in_month2)) {
days_between = 0;
} else {
- days_between = (dtv1.day() - dtv2.day()) / (double)31.0;
+ days_between = (dtv1.day() - dtv2.day()) / 31.0;
}
// calculate months between
diff --git a/be/src/exprs/function/function_jsonb.cpp
b/be/src/exprs/function/function_jsonb.cpp
index 3941a0a6fc7..83c9279f5ad 100644
--- a/be/src/exprs/function/function_jsonb.cpp
+++ b/be/src/exprs/function/function_jsonb.cpp
@@ -1415,8 +1415,7 @@ struct JsonbLengthUtil {
if (!path.seek(path_value.data, path_value.size)) {
return Status::InvalidArgument(
"Json path error: Invalid Json Path for value: {}",
- std::string_view(reinterpret_cast<const
char*>(path_value.data),
- path_value.size));
+ std::string_view(path_value.data,
path_value.size));
}
}
auto jsonb_value = jsonb_data_column->get_data_at(i);
diff --git a/be/src/exprs/function/function_string_search.cpp
b/be/src/exprs/function/function_string_search.cpp
index 16027a3c58e..f3d39c7b381 100644
--- a/be/src/exprs/function/function_string_search.cpp
+++ b/be/src/exprs/function/function_string_search.cpp
@@ -353,10 +353,8 @@ public:
if (num == part_number) {
if (offset == -1) {
- StringOP::push_value_string(
- std::string_view {reinterpret_cast<const
char*>(str.data),
- (size_t)pre_offset},
- i, res_chars, res_offsets);
+ StringOP::push_value_string(std::string_view
{str.data, (size_t)pre_offset},
+ i, res_chars, res_offsets);
} else {
StringOP::push_value_string(
std::string_view {str_str.substr(
@@ -457,10 +455,8 @@ public:
}
if (num == part_number) {
- StringOP::push_value_string(
- std::string_view {reinterpret_cast<const
char*>(str.data),
- (size_t)offset},
- i, res_chars, res_offsets);
+ StringOP::push_value_string(std::string_view
{str.data, (size_t)offset}, i,
+ res_chars, res_offsets);
} else {
StringOP::push_value_string(std::string_view(str.data,
str.size), i,
res_chars, res_offsets);
@@ -493,10 +489,8 @@ public:
}
if (num == part_number) {
- StringOP::push_value_string(
- std::string_view {reinterpret_cast<const
char*>(str.data),
- (size_t)offset},
- i, res_chars, res_offsets);
+ StringOP::push_value_string(std::string_view
{str.data, (size_t)offset}, i,
+ res_chars, res_offsets);
} else {
StringOP::push_value_string(std::string_view(str.data,
str.size), i,
res_chars, res_offsets);
@@ -511,11 +505,9 @@ public:
auto substr = str_str;
// Use pre-created StringRef for constant delimiters
- StringRef delimiter_str =
- const_delimiter_ref
- ? const_delimiter_ref.value()
- : StringRef(reinterpret_cast<const
char*>(delimiter.data),
- delimiter.size);
+ StringRef delimiter_str = const_delimiter_ref
+ ? const_delimiter_ref.value()
+ : StringRef(delimiter.data,
delimiter.size);
while (num <= neg_part_number && offset >= 0) {
offset = (int)substr.rfind(delimiter_str, offset);
diff --git a/be/src/format/orc/vorc_reader.cpp
b/be/src/format/orc/vorc_reader.cpp
index 33ca121c988..d651ac11245 100644
--- a/be/src/format/orc/vorc_reader.cpp
+++ b/be/src/format/orc/vorc_reader.cpp
@@ -748,7 +748,7 @@ std::tuple<bool, orc::Literal> convert_to_orc_literal(const
orc::Type* type,
} else if constexpr (primitive_type == TYPE_INT) {
return std::make_tuple(true,
orc::Literal(int64_t(*((int32_t*)value))));
} else if constexpr (primitive_type == TYPE_BIGINT) {
- return std::make_tuple(true,
orc::Literal(int64_t(*((int64_t*)value))));
+ return std::make_tuple(true, orc::Literal(*((int64_t*)value)));
}
return std::make_tuple(false, orc::Literal(false));
}
@@ -756,7 +756,7 @@ std::tuple<bool, orc::Literal> convert_to_orc_literal(const
orc::Type* type,
if constexpr (primitive_type == TYPE_FLOAT) {
return std::make_tuple(true,
orc::Literal(double(*((float*)value))));
} else if constexpr (primitive_type == TYPE_DOUBLE) {
- return std::make_tuple(true,
orc::Literal(double(*((double*)value))));
+ return std::make_tuple(true, orc::Literal(*((double*)value)));
}
return std::make_tuple(false, orc::Literal(false));
}
diff --git a/be/src/format/table/iceberg_reader_mixin.h
b/be/src/format/table/iceberg_reader_mixin.h
index 50f29095e25..bd049342195 100644
--- a/be/src/format/table/iceberg_reader_mixin.h
+++ b/be/src/format/table/iceberg_reader_mixin.h
@@ -593,7 +593,7 @@ Status
IcebergReaderMixin<BaseReader>::_expand_block_if_need(Block* block) {
return Status::InternalError("Wrong expand column '{}'", col.name);
}
names.insert(col.name);
- (*this->col_name_to_block_idx_ref())[col.name] =
static_cast<uint32_t>(block->columns());
+ (*this->col_name_to_block_idx_ref())[col.name] = block->columns();
block->insert({col.type->create_column(), col.type, col.name});
}
return Status::OK();
diff --git a/be/src/format/table/paimon_predicate_converter.cpp
b/be/src/format/table/paimon_predicate_converter.cpp
index 0ef73e91890..6fa6d4907e7 100644
--- a/be/src/format/table/paimon_predicate_converter.cpp
+++ b/be/src/format/table/paimon_predicate_converter.cpp
@@ -405,7 +405,7 @@ std::optional<paimon::Literal>
PaimonPredicateConverter::_convert_literal(
if (slot_primitive == TYPE_INT) {
return paimon::Literal(static_cast<int32_t>(value));
}
- return paimon::Literal(static_cast<int64_t>(value));
+ return paimon::Literal(value);
}
case TYPE_DOUBLE: {
if (literal_primitive != TYPE_DOUBLE && literal_primitive !=
TYPE_FLOAT) {
diff --git a/be/src/format/table/transactional_hive_reader.cpp
b/be/src/format/table/transactional_hive_reader.cpp
index 9222a9fa2d0..8e31ff9b37d 100644
--- a/be/src/format/table/transactional_hive_reader.cpp
+++ b/be/src/format/table/transactional_hive_reader.cpp
@@ -284,8 +284,7 @@ Status TransactionalHiveReader::on_before_read_block(Block*
block) {
DataTypePtr data_type = get_data_type_with_default_argument(
DataTypeFactory::instance().create_data_type(i.type, false));
MutableColumnPtr data_column = data_type->create_column();
- (*col_name_to_block_idx_ref())[i.column_lower_case] =
- static_cast<uint32_t>(block->columns());
+ (*col_name_to_block_idx_ref())[i.column_lower_case] = block->columns();
block->insert(
ColumnWithTypeAndName(std::move(data_column), data_type,
i.column_lower_case));
}
diff --git a/be/src/io/cache/block_file_cache_factory.cpp
b/be/src/io/cache/block_file_cache_factory.cpp
index 20ee7bbab58..03f26a0276f 100644
--- a/be/src/io/cache/block_file_cache_factory.cpp
+++ b/be/src/io/cache/block_file_cache_factory.cpp
@@ -99,8 +99,7 @@ Status FileCacheFactory::create_file_cache(const std::string&
cache_base_path,
#else
const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize;
#endif
- size_t disk_capacity =
static_cast<size_t>(static_cast<size_t>(stat.f_blocks) *
-
static_cast<size_t>(block_size));
+ size_t disk_capacity = static_cast<size_t>(stat.f_blocks) *
static_cast<size_t>(block_size);
if (file_cache_settings.capacity == 0 || disk_capacity <
file_cache_settings.capacity) {
LOG_INFO(
"The cache {} config size {} is larger than disk size {}
or zero, recalc "
@@ -298,8 +297,7 @@ std::string validate_capacity(const std::string& path,
int64_t new_capacity,
#else
const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize;
#endif
- size_t disk_capacity =
static_cast<size_t>(static_cast<size_t>(stat.f_blocks) *
-
static_cast<size_t>(block_size));
+ size_t disk_capacity = static_cast<size_t>(stat.f_blocks) *
static_cast<size_t>(block_size);
if (new_capacity == 0 || disk_capacity < new_capacity) {
auto ret = fmt::format(
"The cache {} config size {} is larger than disk size {} or
zero, recalc "
diff --git a/be/src/io/cache/fs_file_cache_storage.cpp
b/be/src/io/cache/fs_file_cache_storage.cpp
index abccb16d542..55cf0eebe4f 100644
--- a/be/src/io/cache/fs_file_cache_storage.cpp
+++ b/be/src/io/cache/fs_file_cache_storage.cpp
@@ -905,7 +905,7 @@ void
FSFileCacheStorage::load_cache_info_into_memory_from_db(BlockFileCache* mgr
args.is_tmp = false;
CacheContext ctx;
- ctx.cache_type = static_cast<FileCacheType>(meta_value.type);
+ ctx.cache_type = meta_value.type;
ctx.expiration_time = meta_value.ttl;
ctx.tablet_id =
meta_key.tablet_id; //TODO(zhengyu): zero if loaded from v2,
we can use this to decide whether the block is loaded from v2 or v3
@@ -1031,7 +1031,7 @@ void
FSFileCacheStorage::load_blocks_directly_unlocked(BlockFileCache* mgr, cons
CacheContext context_original;
context_original.query_id = TUniqueId();
context_original.expiration_time = block_meta->ttl;
- context_original.cache_type = static_cast<FileCacheType>(block_meta->type);
+ context_original.cache_type = block_meta->type;
context_original.tablet_id = key.meta.tablet_id;
if (handle_already_loaded_block(mgr, key.hash, key.offset,
block_meta->size, key.meta.tablet_id,
diff --git a/be/src/io/fs/s3_file_writer.cpp b/be/src/io/fs/s3_file_writer.cpp
index 832a048f3d9..8b9a9f2dfd6 100644
--- a/be/src/io/fs/s3_file_writer.cpp
+++ b/be/src/io/fs/s3_file_writer.cpp
@@ -364,7 +364,7 @@ void S3FileWriter::_upload_one_part(int part_num,
UploadFileBuffer& buf) {
s3_bytes_written_total << buf.get_size();
ObjectCompleteMultiPart completed_part {
- static_cast<int>(part_num), resp.etag.has_value() ?
std::move(resp.etag.value()) : ""};
+ part_num, resp.etag.has_value() ? std::move(resp.etag.value()) :
""};
std::unique_lock<std::mutex> lck {_completed_lock};
_completed_parts.emplace_back(std::move(completed_part));
diff --git a/be/src/load/routine_load/data_consumer.h
b/be/src/load/routine_load/data_consumer.h
index 67ccc0e1bda..0d88cf29553 100644
--- a/be/src/load/routine_load/data_consumer.h
+++ b/be/src/load/routine_load/data_consumer.h
@@ -113,7 +113,7 @@ public:
case RdKafka::Event::EVENT_THROTTLE:
LOG(INFO) << "kafka throttled: " << event.throttle_time() << "ms
by "
- << event.broker_name() << " id " <<
(int)event.broker_id();
+ << event.broker_name() << " id " << event.broker_id();
break;
default:
diff --git a/be/src/service/backend_service.cpp
b/be/src/service/backend_service.cpp
index 22286202069..b4bbb435abd 100644
--- a/be/src/service/backend_service.cpp
+++ b/be/src/service/backend_service.cpp
@@ -244,7 +244,7 @@ void _ingest_binlog(StorageEngine& engine, IngestBinlogArg*
arg) {
Defer defer {[=, &engine, &tstatus, ingest_binlog_tstatus = arg->tstatus,
&watch,
&total_download_bytes, &total_download_files,
&elapsed_time_map]() {
g_ingest_binlog_latency << watch.elapsed_time_microseconds();
- auto elapsed_time_ms =
static_cast<int64_t>(watch.elapsed_time_milliseconds());
+ auto elapsed_time_ms = watch.elapsed_time_milliseconds();
double copy_rate = 0.0;
if (elapsed_time_ms > 0) {
copy_rate = (double)total_download_bytes /
((double)elapsed_time_ms) / 1000;
diff --git a/be/src/service/point_query_executor.h
b/be/src/service/point_query_executor.h
index fb507530591..97d925035da 100644
--- a/be/src/service/point_query_executor.h
+++ b/be/src/service/point_query_executor.h
@@ -181,7 +181,7 @@ public:
LRUCachePolicy* cache() const { return _cache; }
Slice data() const {
- return
{(char*)((RowCacheValue*)_cache->value(_handle))->cache_value,
+ return {((RowCacheValue*)_cache->value(_handle))->cache_value,
reinterpret_cast<LRUHandle*>(_handle)->charge};
}
diff --git a/be/src/storage/index/ann/faiss_ann_index.cpp
b/be/src/storage/index/ann/faiss_ann_index.cpp
index 68b06db2b90..7a8c538a200 100644
--- a/be/src/storage/index/ann/faiss_ann_index.cpp
+++ b/be/src/storage/index/ann/faiss_ann_index.cpp
@@ -983,8 +983,7 @@ doris::Status
FaissVectorIndex::save(lucene::store::Directory* dir) {
// Write codes
const uint8_t* codes = ails->get_codes(i);
size_t codes_bytes = list_size * code_size;
- ivfdata_output->writeBytes(reinterpret_cast<const
uint8_t*>(codes),
- cast_set<Int32>(codes_bytes));
+ ivfdata_output->writeBytes(codes,
cast_set<Int32>(codes_bytes));
// Write ids
const faiss::idx_t* ids = ails->get_ids(i);
diff --git
a/be/src/storage/index/inverted/token_filter/word_delimiter_iterator.cpp
b/be/src/storage/index/inverted/token_filter/word_delimiter_iterator.cpp
index ec8f55cd0c0..1c4ed25d591 100644
--- a/be/src/storage/index/inverted/token_filter/word_delimiter_iterator.cpp
+++ b/be/src/storage/index/inverted/token_filter/word_delimiter_iterator.cpp
@@ -216,8 +216,7 @@ std::string WordDelimiterIterator::to_string() const {
std::ostringstream oss;
std::string substring(_text + _current, _end - _current);
oss << substring << " [" << _current << "-" << _end << "]"
- << " type=0x" << std::hex << std::setw(2) << std::setfill('0')
- << static_cast<int32_t>(type());
+ << " type=0x" << std::hex << std::setw(2) << std::setfill('0') <<
type();
return oss.str();
}
@@ -276,4 +275,4 @@ int32_t WordDelimiterIterator::char_type(UChar32 ch) const {
return get_type(ch);
}
-} // namespace doris::segment_v2::inverted_index
\ No newline at end of file
+} // namespace doris::segment_v2::inverted_index
diff --git a/be/src/storage/segment/bitshuffle_page.h
b/be/src/storage/segment/bitshuffle_page.h
index cb277446d6d..8e13ecdd22c 100644
--- a/be/src/storage/segment/bitshuffle_page.h
+++ b/be/src/storage/segment/bitshuffle_page.h
@@ -137,7 +137,7 @@ public:
*num_written = to_add;
if constexpr (single) {
if constexpr (SIZE_OF_TYPE == 1) {
- *reinterpret_cast<uint8_t*>(&_data[orig_size]) = *vals;
+ _data[orig_size] = *vals;
return Status::OK();
} else if constexpr (SIZE_OF_TYPE == 2) {
*reinterpret_cast<uint16_t*>(&_data[orig_size]) =
@@ -391,7 +391,7 @@ public:
return Status::OK();
}
- size_t max_fetch = std::min(*n, static_cast<size_t>(_num_elements -
_cur_index));
+ size_t max_fetch = std::min(*n, _num_elements - _cur_index);
dst->insert_many_fix_len_data(get_data(_cur_index), max_fetch);
*n = max_fetch;
diff --git a/be/src/storage/segment/historical_row_retriever.cpp
b/be/src/storage/segment/historical_row_retriever.cpp
index ec8c8f9e466..f61bde8d4c0 100644
--- a/be/src/storage/segment/historical_row_retriever.cpp
+++ b/be/src/storage/segment/historical_row_retriever.cpp
@@ -281,7 +281,7 @@ void
PrimaryKeyModelRowRetriever::_maybe_invalid_row_cache(const std::string& ke
_context.tablet_schema->has_row_store_for_all_columns() &&
_context.write_type == DataWriteType::TYPE_DIRECT) {
// invalidate cache
-
RowCache::instance()->erase({static_cast<int64_t>(_context.tablet->tablet_id()),
key});
+ RowCache::instance()->erase({_context.tablet->tablet_id(), key});
}
}
diff --git a/be/src/storage/segment/variant/variant_column_reader.cpp
b/be/src/storage/segment/variant/variant_column_reader.cpp
index cbeca9e6cc7..aa864519233 100644
--- a/be/src/storage/segment/variant/variant_column_reader.cpp
+++ b/be/src/storage/segment/variant/variant_column_reader.cpp
@@ -305,7 +305,7 @@ Status
VariantColumnReader::_create_sparse_merge_reader(ColumnIteratorUPtr* iter
// only collect subcolumns that belong to this bucket to avoid extra
IO.
if (bucket_index.has_value()) {
CHECK(_binary_column_reader->get_type() ==
BinaryColumnType::MULTIPLE_SPARSE);
- uint32_t N =
static_cast<uint32_t>(_binary_column_reader->num_buckets());
+ uint32_t N = _binary_column_reader->num_buckets();
if (N > 1) {
uint32_t b = variant_util::variant_binary_shard_of(
StringRef {path.data(), path.size()}, N);
diff --git a/be/src/storage/tablet/tablet.cpp b/be/src/storage/tablet/tablet.cpp
index 5cecf2effe4..ef745fb56fe 100644
--- a/be/src/storage/tablet/tablet.cpp
+++ b/be/src/storage/tablet/tablet.cpp
@@ -893,8 +893,8 @@ void Tablet::delete_expired_stale_rowset() {
std::vector<int64_t> path_id_vec;
// capture the path version to delete
- _timestamped_version_tracker.capture_expired_paths(
- static_cast<int64_t>(expired_stale_sweep_endtime),
&path_id_vec);
+
_timestamped_version_tracker.capture_expired_paths(expired_stale_sweep_endtime,
+ &path_id_vec);
if (path_id_vec.empty()) {
return;
diff --git a/be/src/util/jni-util.cpp b/be/src/util/jni-util.cpp
index 944b8541146..64f223f75f5 100644
--- a/be/src/util/jni-util.cpp
+++ b/be/src/util/jni-util.cpp
@@ -208,7 +208,7 @@ Status Env::GetJniExceptionMsg(JNIEnv* env, bool log_stack,
const string& prefix
std::string return_msg;
auto* msg_str = env->GetStringUTFChars(msg, nullptr);
return_msg += msg_str;
- env->ReleaseStringUTFChars((jstring)msg, msg_str);
+ env->ReleaseStringUTFChars(msg, msg_str);
if (log_stack) {
jstring stack = static_cast<jstring>(
diff --git a/be/src/util/jni-util.h b/be/src/util/jni-util.h
index 59a9cd503de..b230ac67f47 100644
--- a/be/src/util/jni-util.h
+++ b/be/src/util/jni-util.h
@@ -797,8 +797,7 @@ public:
Status get_byte_elements(JNIEnv* env, jsize start, jsize len, jbyte*
buffer) {
DCHECK(!this->uninitialized());
- env->GetByteArrayRegion((jbyteArray)this->_obj, start, len,
- reinterpret_cast<jbyte*>(buffer));
+ env->GetByteArrayRegion((jbyteArray)this->_obj, start, len, buffer);
RETURN_ERROR_IF_EXC(env);
return Status::OK();
}
diff --git a/be/src/util/url_coding.cpp b/be/src/util/url_coding.cpp
index 6af16f475b4..468f80ea91a 100644
--- a/be/src/util/url_coding.cpp
+++ b/be/src/util/url_coding.cpp
@@ -107,8 +107,7 @@ int64_t base64_decode(const char* data, size_t length,
char* decoded_data) {
auto ret = do_base64_decode(reinterpret_cast<const char*>(data), length,
decoded_data,
&decode_len, BASE64_FORCE_NEON64);
#else
- auto ret = do_base64_decode(reinterpret_cast<const char*>(data), length,
decoded_data,
- &decode_len, 0);
+ auto ret = do_base64_decode(data, length, decoded_data, &decode_len, 0);
#endif
return ret > 0 ? decode_len : -1;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]