Dong Li created KYLIN-2313:
------------------------------

             Summary: 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


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='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]].



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

Reply via email to