mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
dbms: fixed error [#METR-15387].
This commit is contained in:
parent
e267ba87f0
commit
f1dc2f4775
@ -394,6 +394,12 @@ struct MatchImpl
|
||||
regexp->getAnalyzeResult(required_substring, is_trivial, required_substring_is_prefix);
|
||||
|
||||
if (required_substring.empty())
|
||||
{
|
||||
if (!regexp->getRE2()) /// Пустой регексп. Всегда матчит.
|
||||
{
|
||||
memset(&res[0], 1, size * sizeof(res[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
@ -405,6 +411,7 @@ struct MatchImpl
|
||||
prev_offset = offsets[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// NOTE Это почти совпадает со случаем likePatternIsStrstr.
|
||||
|
@ -0,0 +1,2 @@
|
||||
1
|
||||
1
|
2
dbms/tests/queries/0_stateless/00144_empty_regexp.sql
Normal file
2
dbms/tests/queries/0_stateless/00144_empty_regexp.sql
Normal file
@ -0,0 +1,2 @@
|
||||
SELECT match(materialize('Hello'), '');
|
||||
SELECT match('Hello', '');
|
16
dbms/tests/queries/0_stateless/00145_empty_likes.reference
Normal file
16
dbms/tests/queries/0_stateless/00145_empty_likes.reference
Normal file
@ -0,0 +1,16 @@
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
18
dbms/tests/queries/0_stateless/00145_empty_likes.sql
Normal file
18
dbms/tests/queries/0_stateless/00145_empty_likes.sql
Normal file
@ -0,0 +1,18 @@
|
||||
SELECT materialize('Hello') LIKE '';
|
||||
SELECT materialize('Hello') LIKE '%';
|
||||
SELECT materialize('Hello') LIKE '%%';
|
||||
SELECT materialize('Hello') LIKE '%%%';
|
||||
SELECT materialize('Hello') LIKE '%_%';
|
||||
SELECT materialize('Hello') LIKE '_';
|
||||
SELECT materialize('Hello') LIKE '_%';
|
||||
SELECT materialize('Hello') LIKE '%_';
|
||||
|
||||
SELECT 'Hello' LIKE '';
|
||||
SELECT 'Hello' LIKE '%';
|
||||
SELECT 'Hello' LIKE '%%';
|
||||
SELECT 'Hello' LIKE '%%%';
|
||||
SELECT 'Hello' LIKE '%_%';
|
||||
SELECT 'Hello' LIKE '_';
|
||||
SELECT 'Hello' LIKE '_%';
|
||||
SELECT 'Hello' LIKE '%_';
|
||||
|
Loading…
Reference in New Issue
Block a user