mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fix ilike cache
This commit is contained in:
parent
c0d1416bbd
commit
8c0581c503
@ -141,10 +141,7 @@ struct MatchImpl
|
||||
{
|
||||
size_t size = offsets.size();
|
||||
|
||||
constexpr int flags = case_insensitive ?
|
||||
Regexps::Regexp::RE_CASELESS : 0;
|
||||
|
||||
auto regexp = Regexps::get<like, true>(pattern, flags);
|
||||
auto regexp = Regexps::get<like, true, case_insensitive>(pattern);
|
||||
|
||||
std::string required_substring;
|
||||
bool is_trivial;
|
||||
|
@ -58,21 +58,24 @@ namespace Regexps
|
||||
* You must hold the ownership while using the object.
|
||||
* In destructor, it returns the object back to the Pool for further reuse.
|
||||
*/
|
||||
template <bool like, bool no_capture>
|
||||
inline Pool::Pointer get(const std::string & pattern, int flags = 0)
|
||||
template <bool like, bool no_capture, bool case_insensitive = false>
|
||||
inline Pool::Pointer get(const std::string & pattern)
|
||||
{
|
||||
/// C++11 has thread-safe function-local statics on most modern compilers.
|
||||
static Pool known_regexps; /// Different variables for different pattern parameters.
|
||||
|
||||
return known_regexps.get(pattern, [flags, &pattern]
|
||||
return known_regexps.get(pattern, [&pattern]
|
||||
{
|
||||
int flags_final = flags | OptimizedRegularExpression::RE_DOT_NL;
|
||||
int flags = OptimizedRegularExpression::RE_DOT_NL;
|
||||
|
||||
if (no_capture)
|
||||
flags_final |= OptimizedRegularExpression::RE_NO_CAPTURE;
|
||||
flags |= OptimizedRegularExpression::RE_NO_CAPTURE;
|
||||
|
||||
if (case_insensitive)
|
||||
flags |= Regexps::Regexp::RE_CASELESS;
|
||||
|
||||
ProfileEvents::increment(ProfileEvents::RegexpCreated);
|
||||
return new Regexp{createRegexp<like>(pattern, flags_final)};
|
||||
return new Regexp{createRegexp<like>(pattern, flags)};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user