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

Fabian Hueske commented on FLINK-4604:
--------------------------------------

Hi [~anmu],

I think we can implement and add support for {{SqlKind.SUM0}} as part of this 
issue.
For that you have to implement a custom {{Sum0Aggregate}} which extends 
{{SumAggregate}} and overrides the {{prepare()}} method such that it does not 
initialize the aggregate with {{null}} but with {{0}} if the value is {{null}}.

Next you have to fix the {{AggregateUtil}} and separate 
{{SqlSumEmptyIsZeroAggFunction}} from {{SqlSumAggFunction}} and initialize the 
new {{Sum0Aggregate}} and also allow for {{case SqlKind.SUM0 => true}} in 
{{DataSetAggregateRule}}.

If I did not forget a place to add SUM0 support, that should do the trick.

> Add support for standard deviation/variance
> -------------------------------------------
>
>                 Key: FLINK-4604
>                 URL: https://issues.apache.org/jira/browse/FLINK-4604
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Anton Mushin
>         Attachments: 1.jpg
>
>
> Calcite's {{AggregateReduceFunctionsRule}} can convert SQL {{AVG, STDDEV_POP, 
> STDDEV_SAMP, VAR_POP, VAR_SAMP}} to sum/count functions. We should add, test 
> and document this rule. 
> If we also want to add this aggregates to Table API is up for discussion.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to