v.21.4New Features
Added dictGetOrNull function to return Null for missing keys
Added functiondictGetOrNull. It works likedictGet, but returnNullin case key was not found in dictionary. Closes #22375. #22413 (Maksim Kita).
Why it matters
This function addresses the limitation ofdictGet that throws an exception when a key is missing in the dictionary, enabling queries to continue smoothly and handle missing keys gracefully by returning Null.How to use it
ReplacedictGet with dictGetOrNull in your queries where dictionary keys might be missing to avoid exceptions. Usage syntax is similar to dictGet, for example:SELECT dictGetOrNull('dictionary_name', 'attribute_name', toUInt64(key))
FROM table