提交 8c882147 编写于 作者: A Alexey Milovidov

Fix issue #11286; add a test

上级 94887f0c
......@@ -181,8 +181,11 @@ const KeyCondition::AtomMap KeyCondition::atom_map
},
{
"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.range = Range("");
return true;
......@@ -190,8 +193,11 @@ const KeyCondition::AtomMap KeyCondition::atom_map
},
{
"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.range = Range("");
return true;
......
--- 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
---
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;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册