ISSUES-30801: Remove not like function into RPNElement

This commit is contained in:
sundy-li 2021-11-09 10:57:37 +08:00
parent fc2cb9726d
commit 3a981de643
3 changed files with 15 additions and 21 deletions

View File

@ -276,27 +276,6 @@ const KeyCondition::AtomMap KeyCondition::atom_map
return true;
}
},
{
"notLike",
[] (RPNElement & out, const Field & value)
{
if (value.getType() != Field::Types::String)
return false;
String prefix = extractFixedPrefixFromLikePattern(value.get<const String &>());
if (prefix.empty())
return false;
String right_bound = firstStringThatIsGreaterThanAllStringsWithPrefix(prefix);
out.function = RPNElement::FUNCTION_NOT_IN_RANGE;
out.range = !right_bound.empty()
? Range(prefix, true, right_bound, false)
: Range::createLeftBounded(prefix, true);
return true;
}
},
{
"startsWith",
[] (RPNElement & out, const Field & value)

View File

@ -0,0 +1,6 @@
1.1
1
1.2
1.12
1
1.1

View File

@ -0,0 +1,9 @@
drop table if exists test;
create table test (a String) Engine MergeTree order by a partition by a;
insert into test values('1'), ('1.1'), ('1.2'), ('1.12');
select * from test where a like '1%1';
select * from test where a not like '1%1';
select * from test where a not like '1%2';
drop table test;