v.24.8Improvement
Function mapFromArrays Enhancements: Supports Map as First Argument and Nullable Array Types
FunctionmapFromArraysnow acceptsMap(K, V)as first argument, for example:SELECT mapFromArrays(map('a', 4, 'b', 4), ['aa', 'bb'])now works and returns{('a',4):'aa',('b',4):'bb'}. Also, if the 1st argument is an Array, it can now also be of typeArray(Nullable(T))orArray(LowCardinality(Nullable(T)))as long as the actual array values are notNULL. #67103 (李扬).
Why it matters
This enhancement allows users to create maps by using an existing map as the keys array or by using arrays with nullable or low cardinality nullable types, increasing flexibility and usability of themapFromArrays function in varied data scenarios.How to use it
You can pass a map as the first argument tomapFromArrays to serve as keys, for example:SELECT mapFromArrays(map('a', 4, 'b', 4), ['aa', 'bb'])This will return a map where composite keys from the first map are mapped to corresponding array values. Additionally, you can use arrays of type
Array(Nullable(T)) or Array(LowCardinality(Nullable(T))) for the first array argument, provided that none of the values are NULL.