v.24.5New Feature

Maps Support Additional Key Types in ClickHouse

Maps can now have Float32, Float64, Array(T), Map(K, V) and Tuple(T1, T2, ...) as keys. Closes #54537. #59318 (李扬).
Maps in ClickHouse now support keys of types Float32, Float64, Array(T), Map(K, V), and Tuple(T1, T2, ...).

Why it matters

This feature extends the flexibility and usability of the Map data type by allowing more complex and varied key types beyond the previously supported ones. It enables users to create richer data structures and perform more advanced queries by using complex key types in maps.

How to use it

Users can define Map columns with the newly supported key types directly in their table schemas or queries, for example:

CREATE TABLE example (
id Int32,
data Map(Float64, String)
) ENGINE = MergeTree() ORDER BY id;


This allows you to use floating point numbers, arrays, maps, or tuples as keys in maps without any additional configuration.