mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 05:22:17 +00:00
Fix issue #11286; add a test
This commit is contained in:
parent
94887f0c74
commit
8c8821475c
@ -181,8 +181,11 @@ const KeyCondition::AtomMap KeyCondition::atom_map
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"empty",
|
"empty",
|
||||||
[] (RPNElement & out, const Field &)
|
[] (RPNElement & out, const Field & value)
|
||||||
{
|
{
|
||||||
|
if (value.getType() != Field::Types::String)
|
||||||
|
return false;
|
||||||
|
|
||||||
out.function = RPNElement::FUNCTION_IN_RANGE;
|
out.function = RPNElement::FUNCTION_IN_RANGE;
|
||||||
out.range = Range("");
|
out.range = Range("");
|
||||||
return true;
|
return true;
|
||||||
@ -190,8 +193,11 @@ const KeyCondition::AtomMap KeyCondition::atom_map
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"notEmpty",
|
"notEmpty",
|
||||||
[] (RPNElement & out, const Field &)
|
[] (RPNElement & out, const Field & value)
|
||||||
{
|
{
|
||||||
|
if (value.getType() != Field::Types::String)
|
||||||
|
return false;
|
||||||
|
|
||||||
out.function = RPNElement::FUNCTION_NOT_IN_RANGE;
|
out.function = RPNElement::FUNCTION_NOT_IN_RANGE;
|
||||||
out.range = Range("");
|
out.range = Range("");
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
--- notEmpty
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- empty
|
||||||
|
[] 1
|
||||||
|
--- = []
|
||||||
|
[] 1
|
||||||
|
--- != []
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- > []
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- < []
|
||||||
|
--- >= []
|
||||||
|
[] 1
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- <= []
|
||||||
|
[] 1
|
||||||
|
---
|
||||||
|
--- notEmpty
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- empty
|
||||||
|
[] 1
|
||||||
|
--- = []
|
||||||
|
[] 1
|
||||||
|
--- != []
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- > []
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- < []
|
||||||
|
--- >= []
|
||||||
|
[] 1
|
||||||
|
['a'] 2
|
||||||
|
['a','b','c'] 3
|
||||||
|
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'] 4
|
||||||
|
--- <= []
|
||||||
|
[] 1
|
||||||
|
---
|
@ -0,0 +1,66 @@
|
|||||||
|
drop table if exists count_lc_test;
|
||||||
|
|
||||||
|
CREATE TABLE count_lc_test
|
||||||
|
(
|
||||||
|
`s` LowCardinality(String),
|
||||||
|
`arr` Array(LowCardinality(String)),
|
||||||
|
`num` UInt64
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree
|
||||||
|
ORDER BY (s, arr);
|
||||||
|
|
||||||
|
INSERT INTO count_lc_test(num, arr) VALUES (1,[]),(2,['a']),(3,['a','b','c']),(4,['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']);
|
||||||
|
|
||||||
|
SELECT '--- notEmpty';
|
||||||
|
select * from count_lc_test where notEmpty(arr);
|
||||||
|
SELECT '--- empty';
|
||||||
|
select * from count_lc_test where empty(arr);
|
||||||
|
SELECT '--- = []';
|
||||||
|
select * from count_lc_test where arr = [];
|
||||||
|
SELECT '--- != []';
|
||||||
|
select * from count_lc_test where arr != [];
|
||||||
|
SELECT '--- > []';
|
||||||
|
select * from count_lc_test where arr > [];
|
||||||
|
SELECT '--- < []';
|
||||||
|
select * from count_lc_test where arr < [];
|
||||||
|
SELECT '--- >= []';
|
||||||
|
select * from count_lc_test where arr >= [];
|
||||||
|
SELECT '--- <= []';
|
||||||
|
select * from count_lc_test where arr <= [];
|
||||||
|
SELECT '---';
|
||||||
|
|
||||||
|
DROP TABLE count_lc_test;
|
||||||
|
|
||||||
|
|
||||||
|
drop table if exists count_lc_test;
|
||||||
|
|
||||||
|
CREATE TABLE count_lc_test
|
||||||
|
(
|
||||||
|
`s` LowCardinality(String),
|
||||||
|
`arr` Array(String),
|
||||||
|
`num` UInt64
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree
|
||||||
|
ORDER BY (s, arr);
|
||||||
|
|
||||||
|
INSERT INTO count_lc_test(num, arr) VALUES (1,[]),(2,['a']),(3,['a','b','c']),(4,['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']);
|
||||||
|
|
||||||
|
SELECT '--- notEmpty';
|
||||||
|
select * from count_lc_test where notEmpty(arr);
|
||||||
|
SELECT '--- empty';
|
||||||
|
select * from count_lc_test where empty(arr);
|
||||||
|
SELECT '--- = []';
|
||||||
|
select * from count_lc_test where arr = [];
|
||||||
|
SELECT '--- != []';
|
||||||
|
select * from count_lc_test where arr != [];
|
||||||
|
SELECT '--- > []';
|
||||||
|
select * from count_lc_test where arr > [];
|
||||||
|
SELECT '--- < []';
|
||||||
|
select * from count_lc_test where arr < [];
|
||||||
|
SELECT '--- >= []';
|
||||||
|
select * from count_lc_test where arr >= [];
|
||||||
|
SELECT '--- <= []';
|
||||||
|
select * from count_lc_test where arr <= [];
|
||||||
|
SELECT '---';
|
||||||
|
|
||||||
|
DROP TABLE count_lc_test;
|
Loading…
Reference in New Issue
Block a user