v.21.2New Features
Add Functions for Map Data Type: Check Key Existence, Retrieve Keys and Values
Add three functions for map data type: 1.mapContains(map, key)to check weather map.keys include the second parameter key. 2.mapKeys(map)return all the keys in Array format 3.mapValues(map)return all the values in Array format. #18788 (hexiaoting).
Why it matters
These functions enhance working withmap data types by providing convenient ways to query the presence of keys and extract all keys or values, simplifying data manipulation and improving query expressiveness in ClickHouse.How to use it
Use the functions directly in your SQL queries. For example:SELECT mapContains(my_map_column, 'key') FROM my_table;
SELECT mapKeys(my_map_column) FROM my_table;
SELECT mapValues(my_map_column) FROM my_table;