mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
dbms: fixed error [#METR-15387].
This commit is contained in:
parent
e267ba87f0
commit
f1dc2f4775
@ -395,14 +395,21 @@ struct MatchImpl
|
||||
|
||||
if (required_substring.empty())
|
||||
{
|
||||
size_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
if (!regexp->getRE2()) /// Пустой регексп. Всегда матчит.
|
||||
{
|
||||
res[i] = revert ^ regexp->getRE2()->Match(
|
||||
re2_st::StringPiece(reinterpret_cast<const char *>(&data[prev_offset]), offsets[i] - prev_offset - 1),
|
||||
0, offsets[i] - prev_offset - 1, re2_st::RE2::UNANCHORED, nullptr, 0);
|
||||
memset(&res[0], 1, size * sizeof(res[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t prev_offset = 0;
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
res[i] = revert ^ regexp->getRE2()->Match(
|
||||
re2_st::StringPiece(reinterpret_cast<const char *>(&data[prev_offset]), offsets[i] - prev_offset - 1),
|
||||
0, offsets[i] - prev_offset - 1, re2_st::RE2::UNANCHORED, nullptr, 0);
|
||||
|
||||
prev_offset = offsets[i];
|
||||
prev_offset = offsets[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -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