v.20.5New Feature

minMap and maxMap Functions Added

minMap and maxMap functions were added. #11603 (Ildus Kurbangaliev).
minMap and maxMap aggregate functions have been added to ClickHouse.

Why it matters

These functions provide a way to compute the minimum or maximum values from keys in a map aggregation, enabling users to efficiently extract extremal elements from map data structures within their queries.

How to use it

Use the functions in an aggregate context with map data. For example:

SELECT minMap(map_column) FROM table;
SELECT maxMap(map_column) FROM table;

These will return the minimum or maximum key-value pairs from the aggregated maps respectively.