You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Zhong Yanghong (Jira)" <ji...@apache.org> on 2020/09/29 08:31:00 UTC

[jira] [Commented] (KYLIN-4282) support case when in count (distinct)

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

Zhong Yanghong commented on KYLIN-4282:
---------------------------------------

This feature is mainly for dealing with the limitation of count (distinct ) with some filter. Without this feature, if user wants to query two count (distinct) measures with different filters, he has to use two subqueries first and then do join to combine the results, like follows:
{code}
select T1.col_a, T1.cm1, T2.cm2 
from
(select col_a, count(distinct m1) as cm1 from T where f1... group by 1) T1
inner join
(select col_a, count(distinct m2) as cm2 from T where f2... group by 1) T2
on T1.col_a = T2.col_a
{code}

With this feature, we can only use single query as follows:
{code}
select col_a, count(distinct case when f1 then m1 end) as cm1, count(distinct case when f2 then m2 end) as cm2 from T group by 1
{code}

> support case when in count (distinct)
> -------------------------------------
>
>                 Key: KYLIN-4282
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4282
>             Project: Kylin
>          Issue Type: Improvement
>            Reporter: Zhong Yanghong
>            Assignee: Zhong Yanghong
>            Priority: Major
>             Fix For: v3.1.0
>
>




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