Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.36.0
Description
exists(expr, pred) - Tests whether a predicate holds for one or more elements in the array.
> SELECT `EXISTS`(array(1, 2, 3), x -> x % 2 == 0); true > SELECT `EXISTS`(array(1, 2, 3), x -> x % 2 == 10); false > SELECT `EXISTS`(array(1, null, 3), x -> x % 2 == 0); NULL > SELECT `EXISTS`(array(0, null, 2, 3, null), x -> x IS NULL); true > SELECT `EXISTS`(array(1, 2, 3), x -> x IS NULL); false
In Calcite, EXISTS is a keyword, so we need to specify the function with back quotes.
Moreover, `EXISTS` is a higher-order function, and if we want to support higher-order functions in Calcite, we must first support lambda expressions
Attachments
Issue Links
- is blocked by
-
CALCITE-3679 Allow lambda expressions in SQL queries
- Closed
- relates to
-
CALCITE-6242 The "exists" library function throws a "param not found" error when a column is used in lambda evaluation logic.
- Open
- links to