mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix special case of trivial regexp
Previously, we would alsays set 1 in case of a trivial regex (which is correct). If someone in future builds a negated operator, then this will produce wrong results. Right now, negation of regexp (SQL: NOT MATCH) is implemented at a higher level, so we are safe and this is more a preventive fix.
This commit is contained in:
parent
01ab7b9bad
commit
05e4fa7df1
@ -179,7 +179,7 @@ struct MatchImpl
|
||||
if (!regexp->getRE2()) /// An empty regexp. Always matches.
|
||||
{
|
||||
if (haystack_size)
|
||||
memset(res.data(), 1, haystack_size * sizeof(res[0]));
|
||||
memset(res.data(), !negate, haystack_size * sizeof(res[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -338,7 +338,7 @@ struct MatchImpl
|
||||
if (!regexp->getRE2()) /// An empty regexp. Always matches.
|
||||
{
|
||||
if (haystack_size)
|
||||
memset(res.data(), 1, haystack_size * sizeof(res[0]));
|
||||
memset(res.data(), !negate, haystack_size * sizeof(res[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -490,7 +490,7 @@ struct MatchImpl
|
||||
{
|
||||
if (!regexp.getRE2()) /// An empty regexp. Always matches.
|
||||
{
|
||||
res[i] = 1;
|
||||
res[i] = !negate;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -604,7 +604,7 @@ struct MatchImpl
|
||||
{
|
||||
if (!regexp.getRE2()) /// An empty regexp. Always matches.
|
||||
{
|
||||
res[i] = 1;
|
||||
res[i] = !negate;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user