[
https://issues.apache.org/jira/browse/CALCITE-2935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16798460#comment-16798460
]
Julian Hyde commented on CALCITE-2935:
--------------------------------------
Thanks for the review. It seems that {{BOOL_AND}}, {{BOOL_OR}} win by a nose. I
think we should use those names.
Note that BOOL_OR and BOOL_AND will essentially be aliases for MAX and MIN. if
{{b}} is a boolean value then {{MIN(b)}} is equivalent to {{BOOL_AND(b)}}, and
similarly {{MAX(b)}} is equivalent to {{BOOL_OR(b)}}. And we already support
MIN and MAX on boolean values:
{code}
> select min(b), max(b) from (values false, true, unknown) as t(b);
+--------+--------+
| EXPR$0 | EXPR$1 |
+--------+--------+
| false | true |
+--------+--------+
1 row selected (0.074 seconds)
{code}
> Support ANY, SOME, EVERY (also known as BOOL_OR, BOOL_AND) aggregate
> functions
> -------------------------------------------------------------------------------
>
> Key: CALCITE-2935
> URL: https://issues.apache.org/jira/browse/CALCITE-2935
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Reporter: Haisheng Yuan
> Priority: Major
>
> ANY, SOME is equivalent with bool_or. EVERY is equivalent with bool_and.
> Parser needs to be changed to support these aggregate functions.
> https://blog.jooq.org/2014/12/18/a-true-sql-gem-you-didnt-know-yet-the-every-aggregate-function/
> https://mysqlserverteam.com/using-the-aggregate-functions-any-some-every-with-mysql/
> Note that if ANY or SOME aggregate function is placed on the right side of
> comparison operation and argument of this function is a subquery additional
> parentheses around aggregate function are required, otherwise it will be
> parsed as quantified comparison predicate.
> Example:
> ANY(NAME LIKE 'W%')
> A = (ANY((SELECT B FROM T)))
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)