v.21.2Improvements
Enable function length/empty/notEmpty for Map datatype
Enable function length/empty/notEmpty for datatype Map, which returns keys number in Map. #19530 (taiyang-li).
Why it matters
This feature adds support for thelength, empty, and notEmpty functions on the Map datatype, enabling users to easily determine the size and emptiness of maps in their data. It solves the limitation that these functions previously did not work with Maps, enhancing data inspection and query flexibility.How to use it
Users can directly apply the functions toMap columns as follows:SELECT length(map_column), empty(map_column), notEmpty(map_column) FROM tableThese functions will return the number of keys and boolean checks for emptiness of the Map datatype.