mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
enable empty/notEmpty for map data type
This commit is contained in:
parent
f51c3ee9a3
commit
586def7fa3
@ -96,12 +96,6 @@ public:
|
||||
}
|
||||
else if (const ColumnMap* col_map = checkAndGetColumn<ColumnMap>(column.get()))
|
||||
{
|
||||
// only function length is implemented for ColumnMap
|
||||
// TODO implemented other functions which use FunctionStringOrArrayToT
|
||||
if (getName() != "length")
|
||||
throw Exception("Illegal column " + arguments[0].column->getName() + " of argument of function " + getName(),
|
||||
ErrorCodes::ILLEGAL_COLUMN);
|
||||
|
||||
auto col_res = ColumnVector<ResultType>::create();
|
||||
typename ColumnVector<ResultType>::Container & vec_res = col_res->getData();
|
||||
vec_res.resize(col_map->size());
|
||||
|
@ -1,2 +1,6 @@
|
||||
2
|
||||
2
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
|
@ -1,6 +1,8 @@
|
||||
set allow_experimental_map_type = 1;
|
||||
|
||||
drop table if exists table_map;
|
||||
create table table_map (a Map(String, String)) engine = Memory;
|
||||
insert into table_map values ({'name':'zhangsan', 'gender':'male'}), ({'name':'lisi', 'gender':'female'});
|
||||
select length(a) from table_map;
|
||||
select length(map(1,2,3,4));
|
||||
select length(map());
|
||||
select empty(map(1,2,3,4));
|
||||
select empty(map());
|
||||
select notEmpty(map(1,2,3,4));
|
||||
select notEmpty(map());
|
Loading…
Reference in New Issue
Block a user