You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "hongyu guo (Jira)" <ji...@apache.org> on 2023/11/13 10:43:00 UTC
[jira] [Created] (CALCITE-6116) Add EXISTS function (enabled in Spark library)
hongyu guo created CALCITE-6116:
-----------------------------------
Summary: Add EXISTS function (enabled in Spark library)
Key: CALCITE-6116
URL: https://issues.apache.org/jira/browse/CALCITE-6116
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.36.0
Reporter: hongyu guo
Assignee: hongyu guo
Fix For: 1.37.0
exists(expr, pred) - Tests whether a predicate holds for one or more elements in the array.
{code:sql}
> 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
{code}
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
--
This message was sent by Atlassian Jira
(v8.20.10#820010)