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 67514d75167 [chore](compile)open compile check in some files (#53480)
67514d75167 is described below

commit 67514d751674386732a0cbd2d9be681aefff7a57
Author: zhangstar333 <[email protected]>
AuthorDate: Mon Aug 18 10:45:29 2025 +0800

    [chore](compile)open compile check in some files (#53480)
    
    ### What problem does this PR solve?
    open compile check in some files
---
 be/src/runtime/string_search.hpp                         | 15 +++++++--------
 be/src/util/bitmap.h                                     | 15 +++++++++------
 be/src/util/bitmap_intersect.h                           | 16 +++++++++-------
 .../aggregate_function_approx_top_sum.h                  | 11 +++++++----
 .../aggregate_functions/aggregate_function_percentile.h  | 15 +++++++++------
 5 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/be/src/runtime/string_search.hpp b/be/src/runtime/string_search.hpp
index 63ddaf265c6..97ed563e707 100644
--- a/be/src/runtime/string_search.hpp
+++ b/be/src/runtime/string_search.hpp
@@ -18,14 +18,13 @@
 #pragma once
 
 #include <cstring>
-#include <functional>
-#include <vector>
 
-#include "common/logging.h"
+#include "common/cast_set.h"
 #include "vec/common/string_ref.h"
 #include "vec/common/string_searcher.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 class StringSearch {
 public:
@@ -43,20 +42,20 @@ public:
     //   Returns the offset into str if the pattern exists
     //   Returns -1 if the pattern is not found
     int search(const StringRef* str) const {
-        auto it = search(str->data, str->size);
+        const auto* it = search(str->data, str->size);
         if (it == str->data + str->size) {
             return -1;
         } else {
-            return it - str->data;
+            return cast_set<int>((it - str->data));
         }
     }
 
     int search(const StringRef& str) const {
-        auto it = search(str.data, str.size);
+        const auto* it = search(str.data, str.size);
         if (it == str.data + str.size) {
             return -1;
         } else {
-            return it - str.data;
+            return cast_set<int>(it - str.data);
         }
     }
 
@@ -77,5 +76,5 @@ private:
     const StringRef* _pattern;
     std::unique_ptr<ASCIICaseSensitiveStringSearcher> _str_searcher;
 };
-
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/util/bitmap.h b/be/src/util/bitmap.h
index 22f8858fd51..007defffc59 100644
--- a/be/src/util/bitmap.h
+++ b/be/src/util/bitmap.h
@@ -28,9 +28,11 @@
 #include <string>
 #include <vector>
 
+#include "common/cast_set.h"
 #include "util/bit_util.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 // Return the number of bytes necessary to store the given number of bits.
 inline size_t BitmapSize(size_t num_bits) {
@@ -44,7 +46,8 @@ inline void BitmapSet(uint8_t* bitmap, size_t idx) {
 
 // Switch the given bit to the specified value.
 inline void BitmapChange(uint8_t* bitmap, size_t idx, bool value) {
-    bitmap[idx >> 3] = (bitmap[idx >> 3] & ~(1 << (idx & 7))) | ((!!value) << 
(idx & 7));
+    bitmap[idx >> 3] =
+            cast_set<uint8_t>((bitmap[idx >> 3] & ~(1 << (idx & 7))) | 
((!!value) << (idx & 7)));
 }
 
 // Clear the given bit.
@@ -114,7 +117,7 @@ inline bool BitmapEquals(const uint8_t* bm1, const uint8_t* 
bm2, size_t bitmap_s
         return true;
     }
     DCHECK_LT(num_remaining_bits, 8);
-    uint8_t mask = (1 << num_remaining_bits) - 1;
+    auto mask = (1 << num_remaining_bits) - 1;
     return (bm1[num_full_bytes] & mask) == (bm2[num_full_bytes] & mask);
 }
 
@@ -192,14 +195,14 @@ class Bitmap {
 public:
     Bitmap(int64_t num_bits) {
         DCHECK_GE(num_bits, 0);
-        buffer_.resize(BitUtil::round_up_numi_64(num_bits));
+        
buffer_.resize(BitUtil::round_up_numi_64(cast_set<uint32_t>(num_bits)));
         num_bits_ = num_bits;
     }
 
     /// Resize bitmap and set all bits to zero.
     void Reset(int64_t num_bits) {
         DCHECK_GE(num_bits, 0);
-        buffer_.resize(BitUtil::round_up_numi_64(num_bits));
+        
buffer_.resize(BitUtil::round_up_numi_64(cast_set<uint32_t>(num_bits)));
         num_bits_ = num_bits;
         SetAllBits(false);
     }
@@ -207,7 +210,7 @@ public:
     /// Compute memory usage of a bitmap, not including the Bitmap object 
itself.
     static int64_t MemUsage(int64_t num_bits) {
         DCHECK_GE(num_bits, 0);
-        return BitUtil::round_up_numi_64(num_bits) * sizeof(int64_t);
+        return BitUtil::round_up_numi_64(cast_set<uint32_t>(num_bits)) * 
sizeof(int64_t);
     }
 
     /// Compute memory usage of this bitmap, not including the Bitmap object 
itself.
@@ -248,5 +251,5 @@ private:
     static const int64_t NUM_OFFSET_BITS = 6;
     static const int64_t BIT_INDEX_MASK = 63;
 };
-
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/util/bitmap_intersect.h b/be/src/util/bitmap_intersect.h
index 24700e881bd..876039708ee 100644
--- a/be/src/util/bitmap_intersect.h
+++ b/be/src/util/bitmap_intersect.h
@@ -17,10 +17,12 @@
 #pragma once
 #include <parallel_hashmap/phmap.h>
 
+#include "common/cast_set.h"
 #include "util/bitmap_value.h"
 #include "vec/common/string_ref.h"
 
 namespace doris {
+#include "common/compile_check_begin.h"
 
 namespace detail {
 class Helper {
@@ -72,7 +74,7 @@ char* Helper::write_to<DecimalV2Value>(const DecimalV2Value& 
v, char* dest) {
 
 template <>
 char* Helper::write_to<StringRef>(const StringRef& v, char* dest) {
-    *(int32_t*)dest = v.size;
+    *(int32_t*)dest = cast_set<int32_t>(v.size);
     dest += 4;
     memcpy(dest, v.data, v.size);
     dest += v.size;
@@ -81,7 +83,7 @@ char* Helper::write_to<StringRef>(const StringRef& v, char* 
dest) {
 
 template <>
 char* Helper::write_to<std::string>(const std::string& v, char* dest) {
-    *(uint32_t*)dest = v.size();
+    *(uint32_t*)dest = cast_set<uint32_t>(v.size());
     dest += 4;
     memcpy(dest, v.c_str(), v.size());
     dest += v.size();
@@ -101,12 +103,12 @@ int32_t Helper::serialize_size<DecimalV2Value>(const 
DecimalV2Value& v) {
 
 template <>
 int32_t Helper::serialize_size<StringRef>(const StringRef& v) {
-    return v.size + 4;
+    return cast_set<int32_t>(v.size + 4);
 }
 
 template <>
 int32_t Helper::serialize_size<std::string>(const std::string& v) {
-    return v.size() + 4;
+    return cast_set<int32_t>(v.size() + 4);
 }
 // serialize_size end
 
@@ -214,7 +216,7 @@ public:
     //must call size() first
     void serialize(char* dest) {
         char* writer = dest;
-        *(int32_t*)writer = _bitmaps.size();
+        *(int32_t*)writer = cast_set<int32_t>(_bitmaps.size());
         writer += 4;
         for (auto& kv : _bitmaps) {
             writer = detail::Helper::write_to(kv.first, writer);
@@ -301,7 +303,7 @@ public:
     //must call size() first
     void serialize(char* dest) {
         char* writer = dest;
-        *(int32_t*)writer = _bitmaps.size();
+        *(int32_t*)writer = cast_set<int32_t>(_bitmaps.size());
         writer += 4;
         for (auto& kv : _bitmaps) {
             writer = detail::Helper::write_to(kv.first, writer);
@@ -326,5 +328,5 @@ public:
 protected:
     phmap::flat_hash_map<std::string, BitmapValue> _bitmaps;
 };
-
+#include "common/compile_check_end.h"
 } // namespace doris
diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_top_sum.h 
b/be/src/vec/aggregate_functions/aggregate_function_approx_top_sum.h
index 9471c3c4c05..d09371375d0 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_approx_top_sum.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_approx_top_sum.h
@@ -25,6 +25,7 @@
 #include <cstdint>
 #include <string>
 
+#include "common/cast_set.h"
 #include "vec/aggregate_functions/aggregate_function.h"
 #include "vec/aggregate_functions/aggregate_function_approx_top.h"
 #include "vec/columns/column.h"
@@ -41,6 +42,7 @@
 #include "vec/data_types/data_type_struct.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 struct AggregateFunctionTopKGenericData {
     using Set = SpaceSaving<StringRef, StringRefHash>;
@@ -166,7 +168,7 @@ public:
                 all_serialize_value_into_arena(row_num, _column_names.size(), 
columns, arena);
         const auto& column = assert_cast<const ColVecType&, 
TypeCheckOnRelease::DISABLE>(
                 *columns[_column_names.size() - 1]);
-        set.insert(str_serialized, TResult(column.get_data()[row_num]));
+        set.insert(str_serialized, 
static_cast<uint64_t>(TResult(column.get_data()[row_num])));
         arena.rollback(str_serialized.size);
     }
 
@@ -218,8 +220,9 @@ public:
             for (size_t i = 0; i < _column_names.size(); i++) {
                 begin = 
argument_columns[i]->deserialize_and_insert_from_arena(begin);
                 std::string row_str = 
argument_types[i]->to_string(*argument_columns[i], 0);
-                sub_writer.Key(_column_names[i].data(), 
_column_names[i].size());
-                sub_writer.String(row_str.data(), row_str.size());
+                sub_writer.Key(_column_names[i].data(),
+                               cast_set<uint32_t>(_column_names[i].size()));
+                sub_writer.String(row_str.data(), 
cast_set<uint32_t>(row_str.size()));
             }
             sub_writer.Key("sum");
             sub_writer.String(std::to_string(result.count).c_str());
@@ -241,5 +244,5 @@ struct TopSumSimple {
 
 template <PrimitiveType T>
 using AggregateFunctionApproxTopSumSimple = typename TopSumSimple<T>::Function;
-
+#include "common/compile_check_end.h"
 } // namespace doris::vectorized
\ No newline at end of file
diff --git a/be/src/vec/aggregate_functions/aggregate_function_percentile.h 
b/be/src/vec/aggregate_functions/aggregate_function_percentile.h
index a7517f27d12..1578ec43a1c 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_percentile.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_percentile.h
@@ -23,6 +23,7 @@
 
 #include <boost/iterator/iterator_facade.hpp>
 #include <cmath>
+#include <cstdint>
 #include <memory>
 #include <string>
 #include <vector>
@@ -42,6 +43,7 @@
 #include "vec/data_types/data_type_number.h"
 
 namespace doris::vectorized {
+#include "common/compile_check_begin.h"
 
 class Arena;
 class BufferReadable;
@@ -108,7 +110,7 @@ struct PercentileApproxState {
 
     double get() const {
         if (init_flag) {
-            return digest->quantile(target_quantile);
+            return digest->quantile(static_cast<float>(target_quantile));
         } else {
             return std::nan("");
         }
@@ -131,14 +133,14 @@ struct PercentileApproxState {
         }
     }
 
-    void add(double source) { digest->add(source); }
+    void add(double source) { digest->add(static_cast<float>(source)); }
 
     void add_with_weight(double source, double weight) {
         // the weight should be positive num, as have check the value valid 
use DCHECK_GT(c._weight, 0);
         if (weight <= 0) {
             return;
         }
-        digest->add(source, weight);
+        digest->add(static_cast<float>(source), static_cast<float>(weight));
     }
 
     void reset() {
@@ -330,7 +332,7 @@ struct PercentileState {
         if (!inited_flag) {
             return;
         }
-        int size_num = vec_quantile.size();
+        int size_num = cast_set<int>(vec_quantile.size());
         buf.write_binary(size_num);
         for (const auto& quantile : vec_quantile) {
             buf.write_binary(quantile);
@@ -361,7 +363,7 @@ struct PercentileState {
     }
 
     void add(typename PrimitiveTypeTraits<T>::ColumnItemType source,
-             const PaddedPODArray<Float64>& quantiles, const NullMap& 
null_maps, int arg_size) {
+             const PaddedPODArray<Float64>& quantiles, const NullMap& 
null_maps, int64_t arg_size) {
         if (!inited_flag) {
             vec_counts.resize(arg_size);
             vec_quantile.resize(arg_size, -1);
@@ -397,7 +399,7 @@ struct PercentileState {
         if (!rhs.inited_flag) {
             return;
         }
-        int size_num = rhs.vec_quantile.size();
+        int size_num = cast_set<int>(rhs.vec_quantile.size());
         if (!inited_flag) {
             vec_counts.resize(size_num);
             vec_quantile.resize(size_num, -1);
@@ -562,4 +564,5 @@ public:
     }
 };
 
+#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