mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
add not like to atom map
This commit is contained in:
parent
03be5ffab7
commit
f823b9a177
@ -560,6 +560,27 @@ 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 @@
|
||||
200000
|
@ -0,0 +1,5 @@
|
||||
CREATE TABLE data (str String) ENGINE=MergeTree ORDER BY str;
|
||||
INSERT INTO data (str) SELECT 'aa' FROM numbers(100000);
|
||||
INSERT INTO data (str) SELECT 'ba' FROM numbers(100000);
|
||||
INSERT INTO data (str) SELECT 'ca' FROM numbers(100000);
|
||||
SELECT count()FROM data WHERE str NOT LIKE 'a%' SETTINGS force_primary_key=1;
|
Loading…
Reference in New Issue
Block a user