Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Add missing SQL standard aggregate functions: EVERY, SOME, INTERSECTION.
Examples:
SELECT deptno, EVERY(sal < 3000) AS es, SOME(sal < 1000) AS ss, EVERY(comm < 500) AS ec, SOME(comm < 500) AS sc FROM emp GROUP BY deptno; +--------+-------+-------+-------+------+ | DEPTNO | ES | SS | EC | SC | +--------+-------+-------+-------+------+ | 10 | FALSE | FALSE | | | | 20 | FALSE | TRUE | | | | 30 | TRUE | TRUE | FALSE | TRUE | +--------+-------+-------+-------+------+
EVERY and SOME can be implemented by translating to MIN, MAX:
- EVERY(condition) is equivalent to MIN(condition);
- SOME(condition) is equivalent to MAX(condition)
where condition is a BOOLEAN expression, possibly allowing NULL values).
INTERSECTION computes the intersection of collections (arrays and multisets). (Compare to FUSION, which computes the union of collections.)
FUSION is in the operator table but there is no code-generation for it. This task should implement FUSION and INTERSECTION so that we can run queries in Enumerable mode.
Attachments
Issue Links
- is depended upon by
-
CALCITE-2935 Add BOOL_OR, BOOL_AND, LOGICAL_OR, LOGICAL_AND aggregate functions
- Closed
- relates to
-
CALCITE-6418 Expression with ALL aggregate return unexpected result.
- Open
- links to