You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "liyang (JIRA)" <ji...@apache.org> on 2017/01/15 05:20:26 UTC

[jira] [Resolved] (KYLIN-2313) Cannot find a cube in a subquery case with count distinct

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

liyang resolved KYLIN-2313.
---------------------------
       Resolution: Fixed
    Fix Version/s: v2.0.0

> Cannot find a cube in a subquery case with count distinct
> ---------------------------------------------------------
>
>                 Key: KYLIN-2313
>                 URL: https://issues.apache.org/jira/browse/KYLIN-2313
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: v1.6.0
>            Reporter: Dong Li
>            Assignee: liyang
>            Priority: Minor
>             Fix For: v2.0.0
>
>
> With sample cube, 
> The first query can find a cube and give correct result:
> select p.part_dt, p.lstg_site_id, p.grp, count(distinct user_id), sum(price) from (
> select t.part_dt, t.lstg_site_id, t.user_id, t.price,
> case t.lstg_format_name when 'ABIN' then 'AAA' when 'BBIN' then 'BBB' else 'CCC' end as grp from kylin_sales t) p 
> group by p.part_dt, p.lstg_site_id, p.grp
> The second query will throw exception: cannot find any realization:
> select p.part_dt, p.lstg_site_id, p.grp, count(distinct user_id), sum(price) from (
> select t.part_dt, t.lstg_site_id, t.user_id, t.price,
> case t.lstg_format_name when 'ABIN' then 'AAA'
> when 'BBIN' then 'BBB'
> else 'CCC' end as grp
> from kylin_sales t
> ) p 
> where p.part_dt=DATE'2013-01-01'
> group by p.part_dt, p.lstg_site_id, p.grp
> Error message:
> Error while executing SQL "select p.part_dt, p.lstg_site_id, p.grp, count(distinct user_id), sum(price) from ( select t.part_dt, t.lstg_site_id, t.user_id, t.price, case t.lstg_format_name when 'ABIN' then 'AAA' when 'BBIN' then 'BBB' else 'CCC' end as grp from kylin_sales t ) p where p.part_dt='2013-01-01' group by p.part_dt, p.lstg_site_id, p.grp LIMIT 50000": Can't find any realization. Please confirm with providers. SQL digest: fact table DEFAULT.KYLIN_SALES,group by [DEFAULT.KYLIN_SALES.PART_DT, DEFAULT.KYLIN_SALES.LSTG_SITE_ID, UNKNOWN_MODEL:DEFAULT._KYLIN_TABLE.GRP],filter on [DEFAULT.KYLIN_SALES.PART_DT],with aggregates[FunctionDesc [expression=COUNT_DISTINCT, parameter=ParameterDesc [type=column, value=USER_ID, nextParam=null], returnType=null], FunctionDesc [expression=SUM, parameter=ParameterDesc [type=column, value=PRICE, nextParam=null], returnType=null]].
> The difference between these 2 queries is: there's one condition in the second query: where p.part_dt=DATE'2013-01-01'



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