mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed OptimizedRegularExpression in case of empty regexp
This commit is contained in:
parent
ee710dd1f7
commit
396e9c57d0
@ -309,6 +309,9 @@ bool OptimizedRegularExpressionImpl<thread_safe>::match(const char * subject, si
|
||||
|
||||
if (is_trivial)
|
||||
{
|
||||
if (required_substring.empty())
|
||||
return true;
|
||||
|
||||
if (is_case_insensitive)
|
||||
return haystack_end != case_insensitive_substring_searcher->search(haystack, subject_size);
|
||||
else
|
||||
@ -343,6 +346,9 @@ bool OptimizedRegularExpressionImpl<thread_safe>::match(const char * subject, si
|
||||
|
||||
if (is_trivial)
|
||||
{
|
||||
if (required_substring.empty())
|
||||
return true;
|
||||
|
||||
const UInt8 * pos;
|
||||
if (is_case_insensitive)
|
||||
pos = case_insensitive_substring_searcher->search(haystack, subject_size);
|
||||
@ -402,6 +408,9 @@ unsigned OptimizedRegularExpressionImpl<thread_safe>::match(const char * subject
|
||||
|
||||
if (is_trivial)
|
||||
{
|
||||
if (required_substring.empty())
|
||||
return 1;
|
||||
|
||||
const UInt8 * pos;
|
||||
if (is_case_insensitive)
|
||||
pos = case_insensitive_substring_searcher->search(haystack, subject_size);
|
||||
|
8
dbms/tests/queries/0_stateless/01084_regexp_empty.sql
Normal file
8
dbms/tests/queries/0_stateless/01084_regexp_empty.sql
Normal file
@ -0,0 +1,8 @@
|
||||
DROP DATABASE IF EXISTS test_01084;
|
||||
CREATE DATABASE test_01084;
|
||||
USE test_01084;
|
||||
CREATE TABLE t (x UInt8) ENGINE = Memory;
|
||||
|
||||
SELECT * FROM merge('', '');
|
||||
|
||||
DROP DATABASE test_01084;
|
Loading…
Reference in New Issue
Block a user