This is an automated email from the ASF dual-hosted git repository.
airborne 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 cf52bb690ee [opt](compile) fix compilation warning for index-related
code (#49070)
cf52bb690ee is described below
commit cf52bb690ee6f2260f8f0585816878a9217ecf60
Author: airborne12 <[email protected]>
AuthorDate: Wed Mar 19 11:43:18 2025 +0800
[opt](compile) fix compilation warning for index-related code (#49070)
Problem Summary:
Fix 64->32 implicit conversion
---
be/src/exprs/block_bloom_filter.hpp | 6 ++--
be/src/exprs/block_bloom_filter_impl.cc | 5 ++--
be/src/olap/itoken_extractor.h | 6 ++--
be/src/olap/match_predicate.cpp | 9 +++---
.../olap/rowset/segment_v2/bitmap_index_reader.cpp | 5 ++--
.../olap/rowset/segment_v2/bitmap_index_reader.h | 6 ++--
.../olap/rowset/segment_v2/bitmap_index_writer.cpp | 20 ++++++-------
be/src/olap/rowset/segment_v2/bloom_filter.h | 33 ++++++++++------------
.../segment_v2/bloom_filter_index_reader.cpp | 15 +++++-----
.../segment_v2/bloom_filter_index_writer.cpp | 9 +++---
.../inverted_index/analyzer/analyzer.cpp | 4 ++-
.../inverted_index/analyzer/icu/icu_tokenizer.cpp | 9 +++---
.../char_filter/char_replace_char_filter.cpp | 13 +++++----
.../olap/rowset/segment_v2/ngram_bloom_filter.cpp | 18 ++++++------
be/src/olap/rowset/segment_v2/ngram_bloom_filter.h | 12 ++++----
15 files changed, 89 insertions(+), 81 deletions(-)
diff --git a/be/src/exprs/block_bloom_filter.hpp
b/be/src/exprs/block_bloom_filter.hpp
index b7d488a3003..b55565072ad 100644
--- a/be/src/exprs/block_bloom_filter.hpp
+++ b/be/src/exprs/block_bloom_filter.hpp
@@ -36,6 +36,7 @@ class IOBufAsZeroCopyInputStream;
}
namespace doris {
+#include "common/compile_check_begin.h"
//
https://github.com/apache/kudu/blob/master/src/kudu/util/block_bloom_filter.h
// BlockBloomFilter is modified based on Impala's BlockBloomFilter.
@@ -75,7 +76,7 @@ public:
// Same as above with convenience of hashing the key.
void insert(const StringRef& key) noexcept {
if (key.data) {
- insert(HashUtil::crc_hash(key.data, key.size, _hash_seed));
+ insert(HashUtil::crc_hash(key.data, uint32_t(key.size),
_hash_seed));
}
}
@@ -119,7 +120,7 @@ public:
// Same as above with convenience of hashing the key.
bool find(const StringRef& key) const noexcept {
if (key.data) {
- return find(HashUtil::crc_hash(key.data, key.size, _hash_seed));
+ return find(HashUtil::crc_hash(key.data, uint32_t(key.size),
_hash_seed));
}
return false;
}
@@ -279,3 +280,4 @@ private:
};
} // namespace doris
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/exprs/block_bloom_filter_impl.cc
b/be/src/exprs/block_bloom_filter_impl.cc
index e89b9142266..c3dcd166099 100644
--- a/be/src/exprs/block_bloom_filter_impl.cc
+++ b/be/src/exprs/block_bloom_filter_impl.cc
@@ -1,4 +1,3 @@
-
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -37,6 +36,7 @@
#include "util/sse_util.hpp"
namespace doris {
+#include "common/compile_check_begin.h"
constexpr uint32_t BlockBloomFilter::kRehash[8] __attribute__((aligned(32)));
// constexpr data member requires initialization in the class declaration.
@@ -66,7 +66,7 @@ Status BlockBloomFilter::init_internal(const int
log_space_bytes, uint32_t hash_
}
// Don't use _log_num_buckets if it will lead to undefined behavior by a
shift
// that is too large.
- _directory_mask = (1ULL << _log_num_buckets) - 1;
+ _directory_mask = (1 << _log_num_buckets) - 1;
const size_t alloc_size = directory_size();
close(); // Ensure that any previously allocated memory for directory_ is
released.
@@ -269,3 +269,4 @@ Status BlockBloomFilter::merge(const BlockBloomFilter&
other) {
}
} // namespace doris
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/olap/itoken_extractor.h b/be/src/olap/itoken_extractor.h
index d7004d9c8d0..785b6abee8b 100644
--- a/be/src/olap/itoken_extractor.h
+++ b/be/src/olap/itoken_extractor.h
@@ -25,6 +25,7 @@
#include "olap/rowset/segment_v2/bloom_filter.h"
namespace doris {
+#include "common/compile_check_begin.h"
/// Interface for string parsers.
struct ITokenExtractor {
@@ -59,8 +60,9 @@ public:
size_t token_len = 0;
while (cur < length && static_cast<const
Derived*>(this)->next_in_string(
- data, length, &cur, &token_start,
&token_len))
+ data, length, &cur, &token_start,
&token_len)) {
bloom_filter.add_bytes(data + token_start, token_len);
+ }
}
bool string_like_to_bloom_filter(const char* data, size_t length,
@@ -94,5 +96,5 @@ private:
size_t n;
};
} // namespace doris
-
+#include "common/compile_check_end.h"
#endif //DORIS_ITOKEN_EXTRACTOR_H
diff --git a/be/src/olap/match_predicate.cpp b/be/src/olap/match_predicate.cpp
index 683e38775f3..bed1671ab65 100644
--- a/be/src/olap/match_predicate.cpp
+++ b/be/src/olap/match_predicate.cpp
@@ -37,7 +37,7 @@
#include "vec/data_types/data_type_array.h"
namespace doris {
-
+#include "common/compile_check_begin.h"
MatchPredicate::MatchPredicate(uint32_t column_id, const std::string& value,
MatchType match_type)
: ColumnPredicate(column_id), _value(value), _match_type(match_type) {}
@@ -63,9 +63,9 @@ Status MatchPredicate::evaluate(const
vectorized::IndexFieldNameAndTypePair& nam
if (is_string_type(column_desc.type) ||
(column_desc.type == TYPE_ARRAY &&
is_string_type(column_desc.children[0].type))) {
StringRef match_value;
- int32_t length = _value.length();
+ auto length = _value.length();
char* buffer = const_cast<char*>(_value.c_str());
- match_value.replace(buffer, length); //is it safe?
+ match_value.replace(buffer, int32_t(length)); //is it safe?
RETURN_IF_ERROR(iterator->read_from_inverted_index(
name, &match_value, inverted_index_query_type, num_rows,
roaring));
} else if (column_desc.type == TYPE_ARRAY &&
@@ -134,4 +134,5 @@ bool MatchPredicate::_check_evaluate(InvertedIndexIterator*
iterator) const {
return false;
}
-} // namespace doris
\ No newline at end of file
+} // namespace doris
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
b/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
index c76de68b7ba..142d0fc60bb 100644
--- a/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/bitmap_index_reader.cpp
@@ -31,7 +31,7 @@
namespace doris {
namespace segment_v2 {
-
+#include "common/compile_check_begin.h"
Status BitmapIndexReader::load(bool use_page_cache, bool kept_in_memory) {
// TODO yyq: implement a new once flag to avoid status construct.
return _load_once.call([this, use_page_cache, kept_in_memory] {
@@ -59,7 +59,7 @@ Status BitmapIndexReader::new_iterator(BitmapIndexIterator**
iterator) {
Status BitmapIndexIterator::seek_dictionary(const void* value, bool*
exact_match) {
RETURN_IF_ERROR(_dict_column_iter.seek_at_or_after(value, exact_match));
- _current_rowid = _dict_column_iter.get_current_ordinal();
+ _current_rowid =
static_cast<rowid_t>(_dict_column_iter.get_current_ordinal());
return Status::OK();
}
@@ -93,3 +93,4 @@ Status BitmapIndexIterator::read_union_bitmap(rowid_t from,
rowid_t to, roaring:
} // namespace segment_v2
} // namespace doris
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/olap/rowset/segment_v2/bitmap_index_reader.h
b/be/src/olap/rowset/segment_v2/bitmap_index_reader.h
index 8d344e43ac7..df69eb35528 100644
--- a/be/src/olap/rowset/segment_v2/bitmap_index_reader.h
+++ b/be/src/olap/rowset/segment_v2/bitmap_index_reader.h
@@ -37,6 +37,7 @@ class Roaring;
namespace doris {
namespace segment_v2 {
+#include "common/compile_check_begin.h"
class BitmapIndexIterator;
class BitmapIndexPB;
@@ -107,7 +108,7 @@ public:
// Read and union all bitmaps in range [from, to) into `result`
Status read_union_bitmap(rowid_t from, rowid_t to, roaring::Roaring*
result);
- rowid_t bitmap_nums() const { return _reader->bitmap_nums(); }
+ rowid_t bitmap_nums() const { return
static_cast<rowid_t>(_reader->bitmap_nums()); }
rowid_t current_ordinal() const { return _current_rowid; }
@@ -115,8 +116,9 @@ private:
BitmapIndexReader* _reader = nullptr;
IndexedColumnIterator _dict_column_iter;
IndexedColumnIterator _bitmap_column_iter;
- rowid_t _current_rowid;
+ rowid_t _current_rowid = 0;
};
} // namespace segment_v2
} // namespace doris
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/olap/rowset/segment_v2/bitmap_index_writer.cpp
b/be/src/olap/rowset/segment_v2/bitmap_index_writer.cpp
index 227e9140023..711372f61a9 100644
--- a/be/src/olap/rowset/segment_v2/bitmap_index_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/bitmap_index_writer.cpp
@@ -34,9 +34,8 @@
#include "util/slice.h"
#include "vec/common/arena.h"
-namespace doris {
-namespace segment_v2 {
-
+namespace doris::segment_v2 {
+#include "common/compile_check_begin.h"
namespace {
template <typename CppType>
@@ -68,8 +67,7 @@ public:
using CppType = typename CppTypeTraits<field_type>::CppType;
using MemoryIndexType = typename
BitmapIndexTraits<CppType>::MemoryIndexType;
- explicit BitmapIndexWriterImpl(const TypeInfo* type_info)
- : _type_info(type_info), _reverted_index_size(0) {}
+ explicit BitmapIndexWriterImpl(const TypeInfo* type_info) :
_type_info(type_info) {}
~BitmapIndexWriterImpl() override = default;
@@ -134,11 +132,11 @@ public:
bitmaps.push_back(&_null_bitmap);
}
- uint32_t max_bitmap_size = 0;
- std::vector<uint32_t> bitmap_sizes;
+ size_t max_bitmap_size = 0;
+ std::vector<size_t> bitmap_sizes;
for (auto& bitmap : bitmaps) {
bitmap->runOptimize();
- uint32_t bitmap_size = bitmap->getSizeInBytes(false);
+ auto bitmap_size = bitmap->getSizeInBytes(false);
if (max_bitmap_size < bitmap_size) {
max_bitmap_size = bitmap_size;
}
@@ -181,7 +179,7 @@ public:
private:
const TypeInfo* _type_info;
- uint64_t _reverted_index_size;
+ uint64_t _reverted_index_size = 0;
rowid_t _rid = 0;
// row id list for null value
roaring::Roaring _null_bitmap;
@@ -260,5 +258,5 @@ Status BitmapIndexWriter::create(const TypeInfo* type_info,
return Status::OK();
}
-} // namespace segment_v2
-} // namespace doris
+} // namespace doris::segment_v2
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/olap/rowset/segment_v2/bloom_filter.h
b/be/src/olap/rowset/segment_v2/bloom_filter.h
index 2ef050257e1..9db4b4f869d 100644
--- a/be/src/olap/rowset/segment_v2/bloom_filter.h
+++ b/be/src/olap/rowset/segment_v2/bloom_filter.h
@@ -30,9 +30,8 @@
#include "gutil/integral_types.h"
#include "util/murmur_hash3.h"
-namespace doris {
-namespace segment_v2 {
-
+namespace doris::segment_v2 {
+#include "common/compile_check_begin.h"
inline bvar::Adder<int64_t>
g_total_bloom_filter_num("doris_total_bloom_filter_num");
inline bvar::Adder<int64_t>
g_read_bloom_filter_num("doris_read_bloom_filter_num");
inline bvar::Adder<int64_t>
g_write_bloom_filter_num("doris_write_bloom_filter_num");
@@ -80,9 +79,7 @@ public:
static Status create(BloomFilterAlgorithmPB algorithm,
std::unique_ptr<BloomFilter>* bf,
size_t bf_size = 0);
- BloomFilter() : _data(nullptr), _num_bytes(0), _size(0),
_has_null(nullptr) {
- g_total_bloom_filter_num << 1;
- }
+ BloomFilter() { g_total_bloom_filter_num << 1; }
virtual ~BloomFilter() {
if (_data) {
@@ -131,7 +128,7 @@ public:
// for read
// use deep copy to acquire the data
- virtual Status init(const char* buf, uint32_t size, HashStrategyPB
strategy) {
+ virtual Status init(const char* buf, size_t size, HashStrategyPB strategy)
{
if (size <= 1) {
return Status::InvalidArgument("invalid size:{}", size);
}
@@ -161,13 +158,13 @@ public:
void reset() { memset(_data, 0, _size); }
- uint64_t hash(const char* buf, uint32_t size) const {
+ uint64_t hash(const char* buf, size_t size) const {
uint64_t hash_code;
_hash_func(buf, size, DEFAULT_SEED, &hash_code);
return hash_code;
}
- static Result<uint64_t> hash(const char* buf, uint32_t size,
HashStrategyPB strategy) {
+ static Result<uint64_t> hash(const char* buf, size_t size, HashStrategyPB
strategy) {
if (strategy == HASH_MURMUR3_X64_64) {
uint64_t hash_code;
murmur_hash3_x64_64(buf, size, DEFAULT_SEED, &hash_code);
@@ -177,7 +174,7 @@ public:
}
}
- virtual void add_bytes(const char* buf, uint32_t size) {
+ virtual void add_bytes(const char* buf, size_t size) {
if (buf == nullptr) {
*_has_null = true;
return;
@@ -186,7 +183,7 @@ public:
add_hash(code);
}
- bool test_bytes(const char* buf, uint32_t size) const {
+ bool test_bytes(const char* buf, size_t size) const {
if (buf == nullptr) {
return *_has_null;
}
@@ -200,9 +197,9 @@ public:
virtual char* data() const { return _data; }
- uint32_t num_bytes() const { return _num_bytes; }
+ size_t num_bytes() const { return _num_bytes; }
- virtual uint32_t size() const { return _size; }
+ virtual size_t size() const { return _size; }
void set_has_null(bool has_null) { *_has_null = has_null; }
@@ -234,18 +231,18 @@ protected:
char* _data = nullptr;
// optimal bloom filter num bytes
// it is calculated by optimal_bit_num() / 8
- uint32_t _num_bytes;
+ size_t _num_bytes = 0;
// equal to _num_bytes + 1
// last byte is for has_null flag
- uint32_t _size;
+ size_t _size = 0;
// last byte's pointer in data for null flag
bool* _has_null = nullptr;
// is this bf used for write
bool _is_write = false;
private:
- std::function<void(const void*, const int, const uint64_t, void*)>
_hash_func;
+ std::function<void(const void*, const int64_t, const uint64_t, void*)>
_hash_func;
};
-} // namespace segment_v2
-} // namespace doris
+} // namespace doris::segment_v2
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git a/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
b/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
index 7c51f0a24c1..3c638875a86 100644
--- a/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
@@ -20,6 +20,8 @@
#include <gen_cpp/segment_v2.pb.h>
#include <glog/logging.h>
+#include <memory>
+
#include "olap/rowset/segment_v2/bloom_filter.h"
#include "olap/types.h"
#include "util/debug_points.h"
@@ -28,9 +30,8 @@
#include "vec/data_types/data_type.h"
#include "vec/data_types/data_type_factory.hpp"
-namespace doris {
-namespace segment_v2 {
-
+namespace doris::segment_v2 {
+#include "common/compile_check_begin.h"
Status BloomFilterIndexReader::load(bool use_page_cache, bool kept_in_memory,
OlapReaderStatistics* index_load_stats) {
// TODO yyq: implement a new once flag to avoid status construct.
@@ -48,7 +49,7 @@ Status BloomFilterIndexReader::_load(bool use_page_cache,
bool kept_in_memory,
OlapReaderStatistics* index_load_stats) {
const IndexedColumnMetaPB& bf_index_meta =
_bloom_filter_index_meta->bloom_filter();
- _bloom_filter_reader.reset(new IndexedColumnReader(_file_reader,
bf_index_meta));
+ _bloom_filter_reader = std::make_unique<IndexedColumnReader>(_file_reader,
bf_index_meta);
RETURN_IF_ERROR(_bloom_filter_reader->load(use_page_cache, kept_in_memory,
index_load_stats));
update_metadata_size();
return Status::OK();
@@ -59,7 +60,7 @@ Status
BloomFilterIndexReader::new_iterator(std::unique_ptr<BloomFilterIndexIter
DBUG_EXECUTE_IF("BloomFilterIndexReader::new_iterator.fail", {
return Status::InternalError("new_iterator for bloom filter index
failed");
});
- iterator->reset(new BloomFilterIndexIterator(this, index_load_stats));
+ *iterator = std::make_unique<BloomFilterIndexIterator>(this,
index_load_stats);
return Status::OK();
}
@@ -84,5 +85,5 @@ Status BloomFilterIndexIterator::read_bloom_filter(rowid_t
ordinal,
return Status::OK();
}
-} // namespace segment_v2
-} // namespace doris
+} // namespace doris::segment_v2
+#include "common/compile_check_end.h"
diff --git a/be/src/olap/rowset/segment_v2/bloom_filter_index_writer.cpp
b/be/src/olap/rowset/segment_v2/bloom_filter_index_writer.cpp
index 6faad4e3ed1..3031babcbfb 100644
--- a/be/src/olap/rowset/segment_v2/bloom_filter_index_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/bloom_filter_index_writer.cpp
@@ -36,9 +36,8 @@
#include "util/slice.h"
#include "util/types.h"
-namespace doris {
-namespace segment_v2 {
-
+namespace doris::segment_v2 {
+#include "common/compile_check_begin.h"
namespace {
template <typename CppType>
@@ -381,5 +380,5 @@ Status PrimaryKeyBloomFilterIndexWriterImpl::create(const
BloomFilterOptions& bf
return Status::OK();
}
-} // namespace segment_v2
-} // namespace doris
+} // namespace doris::segment_v2
+#include "common/compile_check_end.h"
diff --git a/be/src/olap/rowset/segment_v2/inverted_index/analyzer/analyzer.cpp
b/be/src/olap/rowset/segment_v2/inverted_index/analyzer/analyzer.cpp
index 6ee2c6bb43f..4d9e6286341 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index/analyzer/analyzer.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index/analyzer/analyzer.cpp
@@ -33,6 +33,7 @@
#include
"olap/rowset/segment_v2/inverted_index/char_filter/char_filter_factory.h"
namespace doris::segment_v2::inverted_index {
+#include "common/compile_check_begin.h"
std::unique_ptr<lucene::util::Reader> InvertedIndexAnalyzer::create_reader(
CharFilterMap& char_filter_map) {
@@ -135,8 +136,9 @@ std::vector<std::string>
InvertedIndexAnalyzer::get_analyse_result(
auto analyzer = create_analyzer(inverted_index_ctx.get());
inverted_index_ctx->analyzer = analyzer.get();
auto reader = create_reader(inverted_index_ctx->char_filter_map);
- reader->init(search_str.data(), search_str.size(), true);
+ reader->init(search_str.data(), static_cast<int32_t>(search_str.size()),
true);
return get_analyse_result(reader.get(), analyzer.get(), field_name,
query_type);
}
} // namespace doris::segment_v2::inverted_index
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git
a/be/src/olap/rowset/segment_v2/inverted_index/analyzer/icu/icu_tokenizer.cpp
b/be/src/olap/rowset/segment_v2/inverted_index/analyzer/icu/icu_tokenizer.cpp
index e10b197d517..670ae6c2d08 100644
---
a/be/src/olap/rowset/segment_v2/inverted_index/analyzer/icu/icu_tokenizer.cpp
+++
b/be/src/olap/rowset/segment_v2/inverted_index/analyzer/icu/icu_tokenizer.cpp
@@ -23,7 +23,7 @@
#include <string>
namespace doris::segment_v2 {
-
+#include "common/compile_check_begin.h"
ICUTokenizer::ICUTokenizer() {
this->lowercase = false;
this->ownReader = false;
@@ -65,13 +65,13 @@ Token* ICUTokenizer::next(Token* token) {
subString.toUTF8String(utf8Str_);
}
- token->setNoCopy(utf8Str_.data(), 0, utf8Str_.size());
+ token->setNoCopy(utf8Str_.data(), 0,
static_cast<int32_t>(utf8Str_.size()));
return token;
}
void ICUTokenizer::reset(lucene::util::Reader* reader) {
const char* buf = nullptr;
- int32_t len = reader->read((const void**)&buf, 0, reader->size());
+ int32_t len = reader->read((const void**)&buf, 0,
static_cast<int32_t>(reader->size()));
buffer_ = icu::UnicodeString::fromUTF8(icu::StringPiece(buf, len));
if (!buffer_.isEmpty() && buffer_.isBogus()) {
_CLTHROWT(CL_ERR_Runtime, "Failed to convert UTF-8 string to
UnicodeString.");
@@ -79,4 +79,5 @@ void ICUTokenizer::reset(lucene::util::Reader* reader) {
breaker_->set_text(buffer_.getBuffer(), 0, buffer_.length());
}
-} // namespace doris::segment_v2
\ No newline at end of file
+} // namespace doris::segment_v2
+#include "common/compile_check_end.h"
\ No newline at end of file
diff --git
a/be/src/olap/rowset/segment_v2/inverted_index/char_filter/char_replace_char_filter.cpp
b/be/src/olap/rowset/segment_v2/inverted_index/char_filter/char_replace_char_filter.cpp
index c0545b9cf97..a75bef53d45 100644
---
a/be/src/olap/rowset/segment_v2/inverted_index/char_filter/char_replace_char_filter.cpp
+++
b/be/src/olap/rowset/segment_v2/inverted_index/char_filter/char_replace_char_filter.cpp
@@ -20,7 +20,7 @@
#include <boost/algorithm/string/replace.hpp>
namespace doris {
-
+#include "common/compile_check_begin.h"
CharReplaceCharFilter::CharReplaceCharFilter(lucene::util::Reader* in, const
std::string& pattern,
const std::string& replacement)
: CharFilter(in), _replacement(replacement) {
@@ -42,18 +42,19 @@ int32_t CharReplaceCharFilter::readCopy(void* start,
int32_t off, int32_t len) {
void CharReplaceCharFilter::fill() {
_buf.resize(input_->size());
- input_->readCopy(_buf.data(), 0, _buf.size());
+ input_->readCopy(_buf.data(), 0, static_cast<int32_t>(_buf.size()));
process_pattern(_buf);
- _transformed_input.init(_buf.data(), _buf.size(), false);
+ _transformed_input.init(_buf.data(), static_cast<int32_t>(_buf.size()),
false);
}
void CharReplaceCharFilter::process_pattern(std::string& buf) {
- for (char& c : buf) {
- uint8_t uc = static_cast<uint8_t>(c);
+ for (auto& c : buf) {
+ auto uc = static_cast<uint8_t>(c);
if (_patterns.test(uc)) {
c = _replacement[0];
}
}
}
-} // namespace doris
\ No newline at end of file
+} // namespace doris
+#include "common/compile_check_end.h"
diff --git a/be/src/olap/rowset/segment_v2/ngram_bloom_filter.cpp
b/be/src/olap/rowset/segment_v2/ngram_bloom_filter.cpp
index f4d0953a8b9..1fb62794133 100644
--- a/be/src/olap/rowset/segment_v2/ngram_bloom_filter.cpp
+++ b/be/src/olap/rowset/segment_v2/ngram_bloom_filter.cpp
@@ -23,16 +23,15 @@
#include "gutil/hash/city.h"
#include "gutil/strings/substitute.h"
-namespace doris {
-namespace segment_v2 {
-
+namespace doris::segment_v2 {
+#include "common/compile_check_begin.h"
NGramBloomFilter::NGramBloomFilter(size_t size)
: _size(size),
words((size + sizeof(UnderType) - 1) / sizeof(UnderType)),
filter(words, 0) {}
// for read
-Status NGramBloomFilter::init(const char* buf, uint32_t size, HashStrategyPB
strategy) {
+Status NGramBloomFilter::init(const char* buf, size_t size, HashStrategyPB
strategy) {
if (size == 0) {
return Status::InvalidArgument(strings::Substitute("invalid size:$0",
size));
}
@@ -43,7 +42,7 @@ Status NGramBloomFilter::init(const char* buf, uint32_t size,
HashStrategyPB str
}
words = (_size + sizeof(UnderType) - 1) / sizeof(UnderType);
filter.reserve(words);
- const UnderType* from = reinterpret_cast<const UnderType*>(buf);
+ const auto* from = reinterpret_cast<const UnderType*>(buf);
for (size_t i = 0; i < words; ++i) {
filter[i] = from[i];
}
@@ -51,7 +50,7 @@ Status NGramBloomFilter::init(const char* buf, uint32_t size,
HashStrategyPB str
return Status::OK();
}
-void NGramBloomFilter::add_bytes(const char* data, uint32_t len) {
+void NGramBloomFilter::add_bytes(const char* data, size_t len) {
size_t hash1 = util_hash::CityHash64WithSeed(data, len, 0);
size_t hash2 = util_hash::CityHash64WithSeed(data, len, SEED_GEN);
@@ -62,7 +61,7 @@ void NGramBloomFilter::add_bytes(const char* data, uint32_t
len) {
}
bool NGramBloomFilter::contains(const BloomFilter& bf_) const {
- const NGramBloomFilter& bf = static_cast<const NGramBloomFilter&>(bf_);
+ const auto& bf = static_cast<const NGramBloomFilter&>(bf_);
for (size_t i = 0; i < words; ++i) {
if ((filter[i] & bf.filter[i]) != bf.filter[i]) {
return false;
@@ -70,6 +69,5 @@ bool NGramBloomFilter::contains(const BloomFilter& bf_) const
{
}
return true;
}
-
-} // namespace segment_v2
-} // namespace doris
+} // namespace doris::segment_v2
+#include "common/compile_check_end.h"
diff --git a/be/src/olap/rowset/segment_v2/ngram_bloom_filter.h
b/be/src/olap/rowset/segment_v2/ngram_bloom_filter.h
index 6418ab30c98..f2ba94c5629 100644
--- a/be/src/olap/rowset/segment_v2/ngram_bloom_filter.h
+++ b/be/src/olap/rowset/segment_v2/ngram_bloom_filter.h
@@ -29,6 +29,7 @@ namespace doris {
static constexpr uint64_t SEED_GEN = 217728422;
namespace segment_v2 {
+#include "common/compile_check_begin.h"
enum HashStrategyPB : int;
class NGramBloomFilter : public BloomFilter {
@@ -37,13 +38,13 @@ public:
static const size_t HASH_FUNCTIONS = 2;
using UnderType = uint64_t;
NGramBloomFilter(size_t size);
- void add_bytes(const char* data, uint32_t len) override;
+ void add_bytes(const char* data, size_t len) override;
bool contains(const BloomFilter& bf_) const override;
- Status init(const char* buf, uint32_t size, HashStrategyPB strategy)
override;
+ Status init(const char* buf, size_t size, HashStrategyPB strategy)
override;
char* data() const override {
return reinterpret_cast<char*>(const_cast<uint64_t*>(filter.data()));
}
- uint32_t size() const override { return _size; }
+ size_t size() const override { return _size; }
void add_hash(uint64_t) override {}
bool test_hash(uint64_t hash) const override { return true; }
bool has_null() const override { return true; }
@@ -55,13 +56,14 @@ private:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow-field"
#endif
- size_t _size;
+ size_t _size = 0;
#ifdef __clang__
#pragma clang diagnostic pop
#endif
- size_t words;
+ size_t words = 0;
std::vector<uint64_t> filter;
};
} // namespace segment_v2
} // namespace doris
+#include "common/compile_check_end.h"
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]