hongbin ma created KYLIN-2579:
---------------------------------

             Summary: Improvement on subqueries: reroder subqueries joins with 
RelOptRule
                 Key: KYLIN-2579
                 URL: https://issues.apache.org/jira/browse/KYLIN-2579
             Project: Kylin
          Issue Type: Improvement
            Reporter: hongbin ma
            Assignee: hongbin ma


Current support for subqueries has some limitations. for example, we require  
JOIN on tables precedes JOIN on all subqueries, the following query:

{code:sql}

select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
 , count(*) as TRANS_CNT
 from  

 test_kylin_fact

 inner JOIN test_category_groupings
 ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND 
test_kylin_fact.lstg_site_id = test_category_groupings.site_id 


 inner JOIN (select cal_dt,week_beg_dt from edw.test_cal_dt  where week_beg_dt 
>= DATE '2010-02-10'  ) xxx
 ON test_kylin_fact.cal_dt = xxx.cal_dt 
 
 
 where test_category_groupings.meta_categ_name  <> 'Baby'
 group by test_kylin_fact.lstg_format_name

{code}

works but 

{code:sql}

select test_kylin_fact.lstg_format_name,sum(test_kylin_fact.price) as GMV 
 , count(*) as TRANS_CNT
 from  

 test_kylin_fact

 inner JOIN (select cal_dt,week_beg_dt from edw.test_cal_dt  where week_beg_dt 
>= DATE '2010-02-10'  ) xxx
 ON test_kylin_fact.cal_dt = xxx.cal_dt 
 
 inner JOIN test_category_groupings
 ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND 
test_kylin_fact.lstg_site_id = test_category_groupings.site_id 
 
 
 where test_category_groupings.meta_categ_name  <> 'Baby'
 group by test_kylin_fact.lstg_format_name

{code}

won't work. In this JIRA we'll reroder subqueries joins with RelOptRule



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to