You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "jiezouSH (JIRA)" <ji...@apache.org> on 2019/07/19 05:43:00 UTC
[jira] [Commented] (KYLIN-2636) optimize case when in group by
[ https://issues.apache.org/jira/browse/KYLIN-2636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16888538#comment-16888538 ]
jiezouSH commented on KYLIN-2636:
---------------------------------
[https://git1-us-west.apache.org/repos/asf?p=kylin.git;a=commit;h=94cd373f]
This pr should be reverted
Reason is that calcite's reduceExpressionRule has done the same thing.
eg.
select (case when '3'='1' then test_kylin_fact.SELLER_ID else test_kylin_fact.LEAF_CATEG_ID end) as xxx , sum(price) as sum_price
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
where case when '3'='1' then test_kylin_fact.SELLER_ID < 90 else test_kylin_fact.LEAF_CATEG_ID>65 end
group by case when '3'='1' then test_kylin_fact.SELLER_ID else test_kylin_fact.LEAF_CATEG_ID end
Sql's plan is:
EXECUTION PLAN AFTER REALIZATION IS SET
OlapOLAPToEnumerableConverter
OlapAggregateRel(group=[\{0}], SUM_PRICE=[SUM($1)], ctx=[0@HYBRID[name=ci_inner_join_hybrid]])
OlapProjectRel(XXX=[$4], PRICE=[$8], ctx=[0@HYBRID[name=ci_inner_join_hybrid]])
OlapFilterRel(condition=[>($4, 65)], ctx=[0@HYBRID[name=ci_inner_join_hybrid]])
OlapJoinRel(condition=[AND(=($4, $37), =($5, $38))], joinType=[inner], ctx=[0@HYBRID[name=ci_inner_join_hybrid]])
OlapTableScan(table=[[DEFAULT, TEST_KYLIN_FACT]], ctx=[0@HYBRID[name=ci_inner_join_hybrid]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36]])
OlapTableScan(table=[[DEFAULT, TEST_CATEGORY_GROUPINGS]], ctx=[0@HYBRID[name=ci_inner_join_hybrid]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8]])
> optimize case when in group by
> -------------------------------
>
> Key: KYLIN-2636
> URL: https://issues.apache.org/jira/browse/KYLIN-2636
> Project: Kylin
> Issue Type: Improvement
> Reporter: hongbin ma
> Assignee: hongbin ma
> Priority: Major
> Fix For: v2.0.0
>
>
> Similar to KYLIN-2635, for clauses like:
> {code}
> group by case when 1 = 1 then x 1 = 2 then y else z
> {code}
> kylin only need to pick up x as grouping by column.
> Again, like KYLIN-2635, we'll fix it in KYLIN rather than calcite first
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)