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 2015/10/20 12:04:27 UTC
[jira] [Commented] (KYLIN-1033) Error when joining two sub-queries
[ https://issues.apache.org/jira/browse/KYLIN-1033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14964909#comment-14964909 ]
liyang commented on KYLIN-1033:
-------------------------------
SQL needs a rewrite like
SELECT t1.week_beg_dt, t1.sum_price, t2.cnt
FROM (
select test_cal_dt.week_beg_dt, sum(test_kylin_fact.price) as sum_price
from test_kylin_fact
inner join edw.test_cal_dt as test_cal_dt ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
group by test_cal_dt.week_beg_dt
) t1
inner join (
select test_cal_dt.week_beg_dt, count(*) as cnt
from test_kylin_fact
inner join edw.test_cal_dt as test_cal_dt ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
group by test_cal_dt.week_beg_dt
) t2
on t1.week_beg_dt=t2.week_beg_dt
And then with the patch, it works!
> Error when joining two sub-queries
> ----------------------------------
>
> Key: KYLIN-1033
> URL: https://issues.apache.org/jira/browse/KYLIN-1033
> Project: Kylin
> Issue Type: Bug
> Affects Versions: v1.0
> Reporter: liyang
> Assignee: liyang
> Fix For: v2.0, v1.2
>
> Attachments: 1.x-0001-KYLIN-1033-Error-when-joining-two-sub-queries.patch, 2.x-0001-KYLIN-1033-Error-when-joining-two-sub-queries.patch
>
>
> Copy from mail list:
> 奔跑的蜗牛 99089865@qq.com via apache.org
> We create two cubes in one project. We want to join the two query (querying data from two cube) together.
> But we got the error :
> null while executing SQL: "with a as ( select part_dt,sum(price) amount from kylin_sales group by part_dt ), b as (select part_dt,count(price) cn from kylin_sales group by part_dt) select * from a join b on a.part_dt= b.part_dt LIMIT 50000"
> The example for learn_kylin as following.
> We can get data using query select * from a , select * from b . But when join together,we get error.
> with a as (
> select part_dt,sum(price) amount
> from kylin_sales
> group by part_dt ),
> b as (select part_dt,count(price) cn
> from kylin_sales
> group by part_dt)
> --select * from a
> --select * from b
> select * from a
> join b on a.part_dt= b.part_dt
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)