gary-cloud commented on code in PR #60727:
URL: https://github.com/apache/doris/pull/60727#discussion_r2870145168
##########
be/src/vec/common/variant_util.cpp:
##########
@@ -130,15 +132,36 @@ inline void append_escaped_regex_char(std::string*
regex_output, char ch) {
// Small LRU to cap compiled glob patterns
constexpr size_t kGlobRegexCacheCapacity = 256;
+constexpr size_t kSkipRe2SetThreshold = 32;
+
+struct TransparentStringHash {
+ using is_transparent = void;
+ size_t operator()(std::string_view s) const { return
std::hash<std::string_view> {}(s); }
+ size_t operator()(const std::string& s) const {
+ return std::hash<std::string_view> {}(std::string_view(s));
+ }
+};
+
+struct TransparentStringEq {
+ using is_transparent = void;
+ bool operator()(std::string_view lhs, std::string_view rhs) const { return
lhs == rhs; }
+};
+
+struct CompiledSkipMatcher {
+ phmap::flat_hash_set<std::string, TransparentStringHash,
TransparentStringEq> exact_patterns;
+ std::vector<std::unique_ptr<RE2>> glob_regexes;
+ std::unique_ptr<RE2::Set> glob_regex_set;
+ bool use_re2_set = false;
+};
struct GlobRegexCacheEntry {
std::shared_ptr<RE2> re2;
std::list<std::string>::iterator lru_it;
};
-static std::mutex g_glob_regex_cache_mutex;
-static std::list<std::string> g_glob_regex_cache_lru;
-static std::unordered_map<std::string, GlobRegexCacheEntry> g_glob_regex_cache;
+std::mutex g_glob_regex_cache_mutex;
+std::list<std::string> g_glob_regex_cache_lru;
+std::unordered_map<std::string, GlobRegexCacheEntry> g_glob_regex_cache;
Review Comment:
已删除这些结构,新增新的util文件
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]