v.23.4New Feature
Added Map Functions: mapConcat, mapSort, mapExists
Added functions to work with columns of typeMap:mapConcat,mapSort,mapExists. #48071 (Anton Popov).
Why it matters
These functions enable more flexible and powerful operations onMap data types, allowing users to concatenate maps, sort map entries, and check the existence of keys within maps directly in queries.How to use it
Use the new functions in your SQL queries onMap columns as follows:-
mapConcat(map1, map2, ...) to merge multiple maps into one.-
mapSort(map) to sort the entries of a map by keys.-
mapExists(map, key) to check if a specific key exists in the map.Example:
SELECT mapConcat(map1, map2) AS merged_map FROM table;
SELECT mapSort(my_map) AS sorted_map FROM table;
SELECT mapExists(my_map, 'key_name') AS key_found FROM table;