dbms: fixed error [#METR-15387].

This commit is contained in:
Alexey Milovidov 2015-04-03 19:16:02 +03:00
parent e267ba87f0
commit f1dc2f4775
5 changed files with 51 additions and 6 deletions

View File

@ -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.

View File

@ -0,0 +1,2 @@
1
1

View File

@ -0,0 +1,2 @@
SELECT match(materialize('Hello'), '');
SELECT match('Hello', '');

View File

@ -0,0 +1,16 @@
0
1
1
1
1
0
1
1
0
1
1
1
1
0
1
1

View 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 '%_';