This is an automated email from the ASF dual-hosted git repository.

zhangstar333 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 46d3bed30b0 [chore](check) Add compilation checks to some files 
(#53324)
46d3bed30b0 is described below

commit 46d3bed30b026378a5e8c9c9d6230750e4249690
Author: Mryange <[email protected]>
AuthorDate: Wed Jul 16 11:03:10 2025 +0800

    [chore](check) Add compilation checks to some files (#53324)
    
    ### What problem does this PR solve?
    
    Some files, due to template expansion or historical reasons, are
    difficult to check for issues like [implicit conversion loses integer
    precision]. Therefore, these files will be excluded from checks.
---
 be/src/vec/functions/minus.cpp           |  7 ++++---
 be/src/vec/functions/multiply.cpp        |  7 ++++---
 be/src/vec/functions/plus.cpp            |  7 ++++---
 be/src/vec/functions/random.cpp          |  6 ++++--
 be/src/vec/functions/round.h             |  4 ++--
 be/src/vec/functions/url/functions_url.h |  6 +++---
 be/src/vec/runtime/vdatetime_value.cpp   |  4 ++--
 be/src/vec/runtime/vdatetime_value.h     |  4 ++--
 be/src/vec/utils/histogram_helpers.hpp   |  7 ++++---
 be/src/vec/utils/stringop_substring.h    | 14 ++++++++------
 10 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/be/src/vec/functions/minus.cpp b/be/src/vec/functions/minus.cpp
index 124d8bd179b..8f0eba7eb66 100644
--- a/be/src/vec/functions/minus.cpp
+++ b/be/src/vec/functions/minus.cpp
@@ -22,7 +22,7 @@
 #include "vec/functions/simple_function_factory.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_begin.h"
 template <PrimitiveType TypeA, PrimitiveType TypeB>
 struct MinusDecimalImpl {
     static_assert(is_decimal(TypeA) && is_decimal(TypeB));
@@ -39,7 +39,8 @@ struct MinusDecimalImpl {
         requires(is_decimal(Result) && Result != TYPE_DECIMALV2)
     static inline typename PrimitiveTypeTraits<Result>::CppNativeType 
apply(ArgNativeTypeA a,
                                                                             
ArgNativeTypeB b) {
-        return static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(a) - b;
+        return static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(
+                static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(a) - b);
     }
 
     static inline DecimalV2Value apply(const DecimalV2Value& a, const 
DecimalV2Value& b) {
@@ -113,5 +114,5 @@ void register_function_minus(SimpleFunctionFactory& 
factory) {
     
factory.register_function<FunctionPlusMinus<PlusMinusIntegralImpl<MinusImpl<TYPE_DOUBLE>>>>();
     
factory.register_function<FunctionPlusMinus<PlusMinusIntegralImpl<MinusImpl<TYPE_FLOAT>>>>();
 }
-
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/functions/multiply.cpp 
b/be/src/vec/functions/multiply.cpp
index 376a1aec24f..17b80cb50e9 100644
--- a/be/src/vec/functions/multiply.cpp
+++ b/be/src/vec/functions/multiply.cpp
@@ -32,7 +32,7 @@
 #include "vec/functions/simple_function_factory.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_begin.h"
 template <PrimitiveType Type>
 struct MultiplyIntegralImpl {
     static constexpr bool result_is_decimal = false;
@@ -127,7 +127,8 @@ struct MultiplyDecimalImpl {
         requires(is_decimal(Result))
     static inline typename PrimitiveTypeTraits<Result>::CppNativeType 
apply(ArgNativeTypeA a,
                                                                             
ArgNativeTypeB b) {
-        return static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(a) * b;
+        return static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(
+                static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(a) * b);
     }
 
     template <PrimitiveType Result = TYPE_DECIMALV2>
@@ -774,5 +775,5 @@ void register_function_multiply(SimpleFunctionFactory& 
factory) {
     
factory.register_function<FunctionMultiply<MultiplyIntegralImpl<TYPE_FLOAT>>>();
     
factory.register_function<FunctionMultiply<MultiplyIntegralImpl<TYPE_DOUBLE>>>();
 }
-
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/functions/plus.cpp b/be/src/vec/functions/plus.cpp
index c31bff7d812..9a1d57a9ec2 100644
--- a/be/src/vec/functions/plus.cpp
+++ b/be/src/vec/functions/plus.cpp
@@ -22,7 +22,7 @@
 #include "vec/functions/simple_function_factory.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_begin.h"
 template <PrimitiveType Type>
 struct PlusImpl {
     static constexpr auto name = "add";
@@ -47,7 +47,8 @@ struct PlusDecimalImpl {
         requires(is_decimal(Result) && Result != TYPE_DECIMALV2)
     static inline typename PrimitiveTypeTraits<Result>::CppNativeType 
apply(ArgNativeTypeA a,
                                                                             
ArgNativeTypeB b) {
-        return static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(a) + b;
+        return static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(
+                static_cast<typename 
PrimitiveTypeTraits<Result>::CppNativeType>(a) + b);
     }
 
     static inline DecimalV2Value apply(const DecimalV2Value& a, const 
DecimalV2Value& b) {
@@ -113,5 +114,5 @@ void register_function_plus(SimpleFunctionFactory& factory) 
{
     
factory.register_function<FunctionPlusMinus<PlusMinusIntegralImpl<PlusImpl<TYPE_DOUBLE>>>>();
     
factory.register_function<FunctionPlusMinus<PlusMinusIntegralImpl<PlusImpl<TYPE_FLOAT>>>>();
 }
-
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/functions/random.cpp b/be/src/vec/functions/random.cpp
index 559965c8a3a..7bcd3b145e1 100644
--- a/be/src/vec/functions/random.cpp
+++ b/be/src/vec/functions/random.cpp
@@ -40,6 +40,8 @@
 #include "vec/functions/simple_function_factory.h"
 
 namespace doris::vectorized {
+
+#include "common/compile_check_begin.h"
 class Random : public IFunction {
 public:
     static constexpr auto name = "random";
@@ -72,7 +74,7 @@ public:
                 }
                 uint32_t seed = 0;
                 if (!context->get_constant_col(0)->column_ptr->is_null_at(0)) {
-                    seed = 
(*context->get_constant_col(0)->column_ptr)[0].get<int64_t>();
+                    seed = 
(uint32_t)(*context->get_constant_col(0)->column_ptr)[0].get<int64_t>();
                 }
                 generator->seed(seed);
             } else if (context->get_num_args() == 2) {
@@ -161,5 +163,5 @@ void register_function_random(SimpleFunctionFactory& 
factory) {
     factory.register_function<Random>();
     factory.register_alias(Random::name, "rand");
 }
-
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/functions/round.h b/be/src/vec/functions/round.h
index 0352cc09c44..f447c17e789 100644
--- a/be/src/vec/functions/round.h
+++ b/be/src/vec/functions/round.h
@@ -48,7 +48,7 @@
 #include "vec/data_types/data_type_number.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_avoid_begin.h"
 enum class ScaleMode {
     Positive, // round to a number with N decimal places after the decimal 
point
     Negative, // round to an integer with N zero characters
@@ -857,5 +857,5 @@ struct DecimalRoundOneImpl {
         return {std::make_shared<typename 
PrimitiveTypeTraits<Type>::DataType>()};
     }
 };
-
+#include "common/compile_check_avoid_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/functions/url/functions_url.h 
b/be/src/vec/functions/url/functions_url.h
index dce42d4044e..2d6abac4453 100644
--- a/be/src/vec/functions/url/functions_url.h
+++ b/be/src/vec/functions/url/functions_url.h
@@ -24,7 +24,7 @@
 #include "vec/common/memcpy_small.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_begin.h"
 /** URL processing functions. See implementation in separate .cpp files.
   * All functions are not strictly follow RFC, instead they are maximally 
simplified for performance reasons.
   *
@@ -93,7 +93,7 @@ struct ExtractSubstringImpl {
             memcpy_small_allow_read_write_overflow15(&res_data[res_offset], 
start, length);
             res_offset += length;
 
-            res_offsets[i] = res_offset;
+            res_offsets[i] = (ColumnString::Offset)res_offset;
             prev_offset = offsets[i];
         }
         return Status::OK();
@@ -151,5 +151,5 @@ struct CutSubstringImpl {
         res_data.append(start + length, data.data() + data.size());
     }
 };
-
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/runtime/vdatetime_value.cpp 
b/be/src/vec/runtime/vdatetime_value.cpp
index aa69abf4e0c..804c81ed387 100644
--- a/be/src/vec/runtime/vdatetime_value.cpp
+++ b/be/src/vec/runtime/vdatetime_value.cpp
@@ -42,7 +42,7 @@
 #include "vec/common/int_exp.h"
 
 namespace doris {
-
+#include "common/compile_check_avoid_begin.h"
 static const char* s_ab_month_name[] = {"",    "Jan", "Feb", "Mar", "Apr", 
"May", "Jun",
                                         "Jul", "Aug", "Sep", "Oct", "Nov", 
"Dec", nullptr};
 
@@ -3988,5 +3988,5 @@ template bool 
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::MONTH>(
 template bool 
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::YEAR>();
 template bool 
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::QUARTER>();
 template bool 
DateV2Value<DateTimeV2ValueType>::datetime_trunc<TimeUnit::WEEK>();
-
+#include "common/compile_check_avoid_end.h"
 } // namespace doris
diff --git a/be/src/vec/runtime/vdatetime_value.h 
b/be/src/vec/runtime/vdatetime_value.h
index 2ce0c58fc2d..a13b74c1f5a 100644
--- a/be/src/vec/runtime/vdatetime_value.h
+++ b/be/src/vec/runtime/vdatetime_value.h
@@ -49,7 +49,7 @@ class DataTypeDateTimeV2;
 } // namespace doris::vectorized
 
 namespace doris {
-
+#include "common/compile_check_avoid_begin.h"
 enum TimeUnit {
     MICROSECOND,
     MILLISECOND,
@@ -1650,7 +1650,7 @@ struct DateTraits<uint64_t> {
     using T = DateV2Value<DateTimeV2ValueType>;
     using DateType = vectorized::DataTypeDateTimeV2;
 };
-
+#include "common/compile_check_avoid_end.h"
 } // namespace doris
 
 template <>
diff --git a/be/src/vec/utils/histogram_helpers.hpp 
b/be/src/vec/utils/histogram_helpers.hpp
index afb1e5e4305..55ce662ba0f 100644
--- a/be/src/vec/utils/histogram_helpers.hpp
+++ b/be/src/vec/utils/histogram_helpers.hpp
@@ -23,11 +23,12 @@
 
 #include <boost/dynamic_bitset.hpp>
 
+#include "common/cast_set.h"
 #include "vec/data_types/data_type_decimal.h"
 #include "vec/io/io_helper.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_begin.h"
 template <typename T>
 struct Bucket {
 public:
@@ -247,7 +248,7 @@ bool histogram_to_json(rapidjson::StringBuffer& buffer, 
const std::vector<Bucket
     doc.SetObject();
     rapidjson::Document::AllocatorType& allocator = doc.GetAllocator();
 
-    int num_buckets = buckets.size();
+    int num_buckets = cast_set<int>(buckets.size());
     doc.AddMember("num_buckets", num_buckets, allocator);
 
     rapidjson::Value bucket_arr(rapidjson::kArrayType);
@@ -298,5 +299,5 @@ bool histogram_to_json(rapidjson::StringBuffer& buffer, 
const std::vector<Bucket
 
     return !buckets.empty() && buffer.GetSize() > 0;
 }
-
+#include "common/compile_check_end.h"
 } // namespace  doris::vectorized
diff --git a/be/src/vec/utils/stringop_substring.h 
b/be/src/vec/utils/stringop_substring.h
index af2b505efaa..73f4b7e2e63 100644
--- a/be/src/vec/utils/stringop_substring.h
+++ b/be/src/vec/utils/stringop_substring.h
@@ -65,11 +65,11 @@
 #include "vec/common/string_ref.h"
 
 namespace doris::vectorized {
-
+#include "common/compile_check_begin.h"
 struct StringOP {
     static void push_empty_string(size_t index, ColumnString::Chars& chars,
                                   ColumnString::Offsets& offsets) {
-        offsets[index] = chars.size();
+        offsets[index] = (ColumnString::Offset)chars.size();
     }
 
     static void push_null_string(size_t index, ColumnString::Chars& chars,
@@ -83,7 +83,7 @@ struct StringOP {
         ColumnString::check_chars_length(chars.size() + string_value.size(), 
offsets.size());
 
         chars.insert(string_value.data(), string_value.data() + 
string_value.size());
-        offsets[index] = chars.size();
+        offsets[index] = (ColumnString::Offset)chars.size();
     }
 
     static void push_value_string_reserved_and_allow_overflow(const 
std::string_view& string_value,
@@ -92,7 +92,7 @@ struct StringOP {
                                                               
ColumnString::Offsets& offsets) {
         chars.insert_assume_reserved_and_allow_overflow(string_value.data(),
                                                         string_value.data() + 
string_value.size());
-        offsets[index] = chars.size();
+        offsets[index] = (ColumnString::Offset)chars.size();
     }
 
     static void fast_repeat(uint8_t* dst, const uint8_t* src, size_t src_size,
@@ -109,7 +109,7 @@ struct StringOP {
         memcpy(dst_curr, src, src_size);
         dst_curr += src_size;
         for (; repeat_times > 0; k += 1, is_odd = repeat_times & 1, 
repeat_times >>= 1) {
-            int32_t len = src_size * (1 << k);
+            int64_t len = src_size * (1 << k);
             memcpy(dst_curr, dst_begin, len);
             dst_curr += len;
             if (is_odd) {
@@ -212,7 +212,7 @@ private:
                 }
             }
 
-            int fixed_pos = start_value;
+            int64_t fixed_pos = start_value;
             if (fixed_pos < -(int)index.size()) {
                 StringOP::push_empty_string(i, res_chars, res_offsets);
                 continue;
@@ -279,4 +279,6 @@ private:
     }
 };
 
+#include "common/compile_check_end.h"
+
 } // namespace doris::vectorized
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to