Commit 12880d6
feat: add array_first higher-order array function
Add `array_first(array, predicate)`, a higher-order function that returns
the first element of an array for which the lambda predicate returns true.
It returns null when the array is empty or no element matches; a predicate
that returns null for an element is treated as not matching, and a matched
null element is returned as null.
Implemented as a `HigherOrderUDFImpl` alongside the existing array lambda
functions (`array_any_match`, `array_filter`, `array_transform`), with
`list_first` as an alias. Includes unit tests, sqllogictest coverage, and
generated documentation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d302350 commit 12880d6
4 files changed
Lines changed: 582 additions & 0 deletions
File tree
- datafusion
- functions-nested/src
- sqllogictest/test_files/array
- docs/source/user-guide/sql
0 commit comments