From 7d50da93cb47d8a3d137941a4fa5536e1f7d2c67 Mon Sep 17 00:00:00 2001 From: 924060929 Date: Mon, 18 Nov 2024 22:51:00 +0800 Subject: [PATCH] [fix](compile) fix macos compile failed (#44061) (#44201) fix macos compile failed, introduced by #40813, #42930, #43218, #43289 --- .../aggregate_functions/aggregate_function_approx_top_k.h | 4 ++-- .../aggregate_functions/aggregate_function_approx_top_sum.h | 4 ++-- be/src/vec/common/space_saving.h | 6 +++--- be/src/vec/exec/scan/scanner_context.cpp | 4 ++-- be/src/vec/exprs/vruntimefilter_wrapper.h | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_top_k.h b/be/src/vec/aggregate_functions/aggregate_function_approx_top_k.h index 6a9b1636fa0d94..93ea3232c311a1 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_approx_top_k.h +++ b/be/src/vec/aggregate_functions/aggregate_function_approx_top_k.h @@ -85,7 +85,7 @@ class AggregateFunctionApproxTopK final void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf, Arena* arena) const override { auto readStringBinaryInto = [](Arena& arena, BufferReadable& buf) { - size_t size = 0; + uint64_t size = 0; read_var_uint(size, buf); if (UNLIKELY(size > DEFAULT_MAX_STRING_SIZE)) { @@ -101,7 +101,7 @@ class AggregateFunctionApproxTopK final auto& set = this->data(place).value; set.clear(); - size_t size = 0; + uint64_t size = 0; read_var_uint(size, buf); if (UNLIKELY(size > TOP_K_MAX_SIZE)) { throw Exception(ErrorCode::INTERNAL_ERROR, 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 9b3ba6a965091a..12b89bd02b51fd 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 @@ -89,7 +89,7 @@ class AggregateFunctionApproxTopSum final void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf, Arena* arena) const override { auto readStringBinaryInto = [](Arena& arena, BufferReadable& buf) { - size_t size = 0; + uint64_t size = 0; read_var_uint(size, buf); if (UNLIKELY(size > DEFAULT_MAX_STRING_SIZE)) { @@ -105,7 +105,7 @@ class AggregateFunctionApproxTopSum final auto& set = this->data(place).value; set.clear(); - size_t size = 0; + uint64_t size = 0; read_var_uint(size, buf); if (UNLIKELY(size > TOP_K_MAX_SIZE)) { throw Exception(ErrorCode::INTERNAL_ERROR, diff --git a/be/src/vec/common/space_saving.h b/be/src/vec/common/space_saving.h index 18fa216228ddfb..4a05ab2b409c10 100644 --- a/be/src/vec/common/space_saving.h +++ b/be/src/vec/common/space_saving.h @@ -244,10 +244,10 @@ class SpaceSaving { void read(BufferReadable& rb) { destroy_elements(); - size_t count = 0; + uint64_t count = 0; read_var_uint(count, rb); - for (size_t i = 0; i < count; ++i) { + for (UInt64 i = 0; i < count; ++i) { std::unique_ptr counter = std::make_unique(); counter->read(rb); counter->hash = counter_map.hash(counter->key); @@ -259,7 +259,7 @@ class SpaceSaving { // Reads the alpha map data from the provided readable buffer. void read_alpha_map(BufferReadable& rb) { - size_t alpha_size = 0; + uint64_t alpha_size = 0; read_var_uint(alpha_size, rb); for (size_t i = 0; i < alpha_size; ++i) { uint64_t alpha = 0; diff --git a/be/src/vec/exec/scan/scanner_context.cpp b/be/src/vec/exec/scan/scanner_context.cpp index d37d26b09f7815..451b3561dad46e 100644 --- a/be/src/vec/exec/scan/scanner_context.cpp +++ b/be/src/vec/exec/scan/scanner_context.cpp @@ -233,7 +233,7 @@ vectorized::BlockUPtr ScannerContext::get_free_block(bool force) { if (_free_blocks.try_dequeue(block)) { DCHECK(block->mem_reuse()); _block_memory_usage -= block->allocated_bytes(); - _scanner_memory_used_counter->set(_block_memory_usage); + _scanner_memory_used_counter->set(static_cast(_block_memory_usage)); // A free block is reused, so the memory usage should be decreased // The caller of get_free_block will increase the memory usage update_peak_memory_usage(-block->allocated_bytes()); @@ -249,7 +249,7 @@ void ScannerContext::return_free_block(vectorized::BlockUPtr block) { if (block->mem_reuse() && _block_memory_usage < _max_bytes_in_queue) { size_t block_size_to_reuse = block->allocated_bytes(); _block_memory_usage += block_size_to_reuse; - _scanner_memory_used_counter->set(_block_memory_usage); + _scanner_memory_used_counter->set(static_cast(_block_memory_usage)); block->clear_column_data(); if (_free_blocks.enqueue(std::move(block))) { update_peak_memory_usage(block_size_to_reuse); diff --git a/be/src/vec/exprs/vruntimefilter_wrapper.h b/be/src/vec/exprs/vruntimefilter_wrapper.h index b75cb520ed4a4a..16d79a78272e78 100644 --- a/be/src/vec/exprs/vruntimefilter_wrapper.h +++ b/be/src/vec/exprs/vruntimefilter_wrapper.h @@ -75,7 +75,8 @@ class VRuntimeFilterWrapper final : public VExpr { template static void judge_selectivity(double ignore_threshold, int64_t filter_rows, int64_t input_rows, T& always_true, TT& judge_counter) { - always_true = filter_rows / (input_rows * 1.0) < ignore_threshold; + always_true = static_cast(filter_rows) / static_cast(input_rows) < + ignore_threshold; judge_counter = config::runtime_filter_sampling_frequency; }