mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
ISSUES-30801: Remove not like function into RPNElement
This commit is contained in:
parent
fc2cb9726d
commit
3a981de643
@ -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)
|
||||
|
@ -0,0 +1,6 @@
|
||||
1.1
|
||||
1
|
||||
1.2
|
||||
1.12
|
||||
1
|
||||
1.1
|
@ -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;
|
Loading…
Reference in New Issue
Block a user