v.24.10New Feature
New Function arrayElementOrNull Returns NULL for Out of Range Indexes and Missing Map Keys
A new functionarrayElementOrNull. It returnsNULLif the array index is out of range or a Map key not found. #69646 (李扬).
Why it matters
This feature addresses the need for safer element access in arrays and Maps by returningNULL instead of throwing an error or exception when the specified index or key does not exist. It helps prevent query failures and simplifies null handling in user queries.How to use it
Use the functionarrayElementOrNull(array, index) for arrays or arrayElementOrNull(map, key) for Maps in your SQL queries. It will return the element at the given position or key, or NULL if the index/key is out of range or missing.