Introduce mapContains, mapKeys, mapValues functions for Map data type#18788
Introduce mapContains, mapKeys, mapValues functions for Map data type#18788nikitamikhaylov merged 6 commits intoClickHouse:masterfrom
Conversation
| select mapContains(a, 'abc') from table_map; | ||
| select mapContains(a, b) from table_map; | ||
| select mapContains(a, 10) from table_map; -- { serverError 43 } | ||
| select mapKeys(a) from table_map; |
There was a problem hiding this comment.
also need tests for mapValues :)
There was a problem hiding this comment.
yes, I forget this.
Added now.
src/Functions/map.cpp
Outdated
| } | ||
| }; | ||
|
|
||
| struct NameMapContains { static constexpr auto name = "mapContains"; }; |
There was a problem hiding this comment.
@alexey-milovidov I think we cannot remove this line, because line199 needs this struct to call FunctionArrayIndex.executeImpl.
| select mapContains(a, 'abc') from table_map; | ||
| select mapContains(a, b) from table_map; | ||
| select mapContains(a, 10) from table_map; -- { serverError 43 } | ||
| select mapKeys(a) from table_map; |
There was a problem hiding this comment.
yes, I forget this.
Added now.
|
Do we need array version i.e. |
Yes, if this is needed, then we will implement it. |
|
@nikitamikhaylov ready to review. |
|
Server crashed , cc @hexiaoting |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add three functions for map data type:
Note: mapContains(map, key) equals has(mapKeys(map), key)
Detailed description / Documentation draft:
Add three functions for map data type:
accept 2 parameters, the first one is a map datatype, the second one should the the same type with map's key type.
return 1 or 0.
accept 2 parameters, the first one is a map datatype
return an array.
accept 2 parameters, the first one is a map datatype
return an array.