[ 
https://issues.apache.org/jira/browse/CALCITE-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17400240#comment-17400240
 ] 

Julian Hyde edited comment on CALCITE-4726 at 9/3/21, 1:06 AM:
---------------------------------------------------------------

{quote}The unique semantics of {{COUNT\(\*)}}
{quote}
There's no other zero-argument aggregate function, but there could be. 
CALCITE-4763 proposes adding an aggregate function {{EXISTS_AGG\(\*)}} that 
returns {{FALSE}} if there are zero rows, and {{TRUE}} if there are one or more 
rows.

{{EXISTS_AGG\(\*)}} is always equivalent to {{COUNT\(\*) > 0}} but it's 
possible that it can be implemented more efficiently.

{{EXISTS_AGG}} would have similar semantics to {{COUNT}}, in that its null 
behavior is moot because it has no arguments.

Related: {{TRUE_AGG}}, a proposed aggregate function that always returns 
{{TRUE}} (CALCITE-4334).


was (Author: julianhyde):
{quote}The unique semantics of {{COUNT(*)}}
{quote}
There's no other zero-argument aggregate function, but there could be. 
CALCITE-4763 proposes adding an aggregate function {{EXISTS_AGG\(\*)}} that 
returns {{FALSE}} if there are zero rows, and {{TRUE}} if there are one or more 
rows.

{{EXISTS_AGG\(\*)}} is always equivalent to {{COUNT\(\*) > 0}} but it's 
possible that it can be implemented more efficiently.

{{EXISTS_AGG}} would have similar semantics to {{COUNT}}, in that its null 
behavior is moot because it has no arguments.

Related: {{TRUE_AGG}}, a proposed aggregate function that always returns 
{{TRUE}} (CALCITE-4334).

> Add support for filters in AggregateExpandWithinDistinctRule
> ------------------------------------------------------------
>
>                 Key: CALCITE-4726
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4726
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Will Noble
>            Assignee: Will Noble
>            Priority: Blocker
>
> Currently, {{AggregateExpandWithinDistinctRule}} does not fire if any of the 
> aggregate calls in the aggregate have a filter. We should support filters.
> For example, the following query will not be handled by the current rule due 
> to the {{FILTER}} clause:
> {code:java}
> SELECT deptno,
>     SUM(sal),
>     SUM(sal) WITHIN DISTINCT (job) FILTER (WHERE ename LIKE 'A%')
> FROM emp
> GROUP BY deptno
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to