You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Shaofeng SHI (JIRA)" <ji...@apache.org> on 2018/06/12 14:39:00 UTC

[jira] [Commented] (KYLIN-3402) kylin not support count distinct in sub

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

Shaofeng SHI commented on KYLIN-3402:
-------------------------------------

hi lemont, now count(distinct 'expression') is not supported yet. 

 

You can try to define a hive view, in which adding a column for the 'expression', and then define a COUNT DISTINCT measure for the new column. Then the pre-calculated measure can be used to accelerate the query.

> kylin not support count distinct in sub
> ---------------------------------------
>
>                 Key: KYLIN-3402
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3402
>             Project: Kylin
>          Issue Type: Improvement
>            Reporter: Lemont
>            Priority: Major
>
> why kylin not support count  distinct in innermost sub-query.To deal with it I have to try another way to write sql,it's very complicated.
> For example id is the Dimensions:
> select count( DISTINCT case when condition = 1 then id end) idCount
>  from (
>  select condition,id
>  from table
> where xxx
> group by xxx
>  )
> To support count distinct I hava to rewrite it to:
> select count(1) from (
> select  case when condition = 1 then id end idCount
> from (
> select condition,id
> from table 
> where xxx
> group by xxx
> ) group by idCount
> )
> I feel so bad with it ,Is there a better solution?
>  Thanks to every answer
>  
>  



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