[ 
https://issues.apache.org/jira/browse/SPARK-30395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

jiaan.geng updated SPARK-30395:
-------------------------------
    Description: 
This ticket is related to https://issues.apache.org/jira/browse/SPARK-27986

This ticket will support:

When one or more DISTINCT aggregate expressions operate on the same field, the 
DISTINCT aggregate expression allows the use of the FILTER clause

such as:

 
{code:java}
select sum(distinct id) filter (where sex = 'man') from student;
select class_id, sum(distinct id) filter (where sex = 'man') from student group 
by class_id;
select count(id) filter (where class_id = 1), sum(distinct id) filter (where 
sex = 'man') from student;
select class_id, count(id) filter (where class_id = 1), sum(distinct id) filter 
(where sex = 'man') from student group by class_id;
select sum(distinct id), sum(distinct id) filter (where sex = 'man') from 
student;
select class_id, sum(distinct id), sum(distinct id) filter (where sex = 'man') 
from student group by class_id;
select class_id, count(id), count(id) filter (where class_id = 1), sum(distinct 
id), sum(distinct id) filter (where sex = 'man') from student group by class_id;
{code}
 

 but not support:

 
{code:java}
select class_id, count(distinct sex), sum(distinct id) filter (where sex = 
'man') from student group by class_id;
select class_id, count(distinct sex) filter (where class_id = 1), sum(distinct 
id) filter (where sex = 'man') from student group by class_id;{code}
https://issues.apache.org/jira/browse/SPARK-30396 used for later.

  was:
This ticket is related to https://issues.apache.org/jira/browse/SPARK-27986

This ticket will support:

When one or more DISTINCT aggregate expressions operate on the same field, the 
DISTINCT aggregate expression allows the use of the FILTER clause

such as:

 
{code:java}
select sum(distinct id) filter (where sex = 'man') from student;
select class_id, sum(distinct id) filter (where sex = 'man') from student group 
by class_id;
select count(id) filter (where class_id = 1), sum(distinct id) filter (where 
sex = 'man') from student;
select class_id, count(id) filter (where class_id = 1), sum(distinct id) filter 
(where sex = 'man') from student group by class_id;
select sum(distinct id), sum(distinct id) filter (where sex = 'man') from 
student;
select class_id, sum(distinct id), sum(distinct id) filter (where sex = 'man') 
from student group by class_id;
select class_id, count(id), count(id) filter (where class_id = 1), sum(distinct 
id), sum(distinct id) filter (where sex = 'man') from student group by class_id;
{code}
 

 but not support:

 


> When one or more DISTINCT aggregate expressions operate on the same field, 
> the DISTINCT aggregate expression allows the use of the FILTER clause
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-30395
>                 URL: https://issues.apache.org/jira/browse/SPARK-30395
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: jiaan.geng
>            Priority: Major
>
> This ticket is related to https://issues.apache.org/jira/browse/SPARK-27986
> This ticket will support:
> When one or more DISTINCT aggregate expressions operate on the same field, 
> the DISTINCT aggregate expression allows the use of the FILTER clause
> such as:
>  
> {code:java}
> select sum(distinct id) filter (where sex = 'man') from student;
> select class_id, sum(distinct id) filter (where sex = 'man') from student 
> group by class_id;
> select count(id) filter (where class_id = 1), sum(distinct id) filter (where 
> sex = 'man') from student;
> select class_id, count(id) filter (where class_id = 1), sum(distinct id) 
> filter (where sex = 'man') from student group by class_id;
> select sum(distinct id), sum(distinct id) filter (where sex = 'man') from 
> student;
> select class_id, sum(distinct id), sum(distinct id) filter (where sex = 
> 'man') from student group by class_id;
> select class_id, count(id), count(id) filter (where class_id = 1), 
> sum(distinct id), sum(distinct id) filter (where sex = 'man') from student 
> group by class_id;
> {code}
>  
>  but not support:
>  
> {code:java}
> select class_id, count(distinct sex), sum(distinct id) filter (where sex = 
> 'man') from student group by class_id;
> select class_id, count(distinct sex) filter (where class_id = 1), 
> sum(distinct id) filter (where sex = 'man') from student group by 
> class_id;{code}
> https://issues.apache.org/jira/browse/SPARK-30396 used for later.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to