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

Fabian Hueske commented on FLINK-5315:
--------------------------------------

I like {{myUdagg.distinct('a)}} and {{multiParamAgg.distinct('a, 'b)}} as 
proposed by [~hequn8128].

I'm not sure about {{'a.count.distinct}} though, because of the point raised by 
[~walterddr]. 

The query 

{code}
table.groupBy('a).select('b.count.distinct)
{code}

could either mean

{code}
SELECT COUNT(DISTINCT b) FROM table GROUP BY a
{code}

or 

{code}
SELECT DISTINCT cnt FROM (SELECT COUNT(b) AS cnt FROM table GROUP BY a)
{code}

On the other hand, the option {{'a.distinct.count}} would be inconsistent with 
the approach for UDAGGs where distinct is applied on the agg function and not 
the parameters.

> Support distinct aggregations in table api
> ------------------------------------------
>
>                 Key: FLINK-5315
>                 URL: https://issues.apache.org/jira/browse/FLINK-5315
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: Kurt Young
>            Assignee: Rong Rong
>            Priority: Major
>
> Such as 
> {code}
> t.select("count(distinct a), sum(b)")
> {code}
> or 
> {code}
> t.select('a.count.distinct), 'b.sum)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to