[jira] [Commented] (HIVE-20850) Puse case conditional from projections to dimension tables if possible

2018-10-31 Thread Zoltan Haindrich (JIRA)


[ 
https://issues.apache.org/jira/browse/HIVE-20850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16670864#comment-16670864
 ] 

Zoltan Haindrich commented on HIVE-20850:
-

patch#1 also contains HIVE-20835

> Puse case conditional from projections to dimension tables if possible
> --
>
> Key: HIVE-20850
> URL: https://issues.apache.org/jira/browse/HIVE-20850
> Project: Hive
>  Issue Type: Improvement
>Reporter: Zoltan Haindrich
>Assignee: Zoltan Haindrich
>Priority: Major
> Attachments: HIVE-20850.01.patch
>
>
> noticed by [~gopalv]: If there is a project which could be only evaluated 
> after the join; but the condition references only a single column from a 
> small dimension table; hive will end up evaluating the same thing over and 
> over again...
> {code}
> explain
> select  s_store_name, s_store_id,
> sum(case when (d_day_name='Sunday') then ss_sales_price else null 
> end) sun_sales,
> sum(case when (d_day_name='Monday') then ss_sales_price else null 
> end) mon_sales,
> sum(case when (d_day_name='Tuesday') then ss_sales_price else  null 
> end) tue_sales,
> sum(case when (d_day_name='Wednesday') then ss_sales_price else null 
> end) wed_sales,
> sum(case when (d_day_name='Thursday') then ss_sales_price else null 
> end) thu_sales,
> sum(case when (d_day_name='Friday') then ss_sales_price else null 
> end) fri_sales,
> sum(case when (d_day_name='Saturday') then ss_sales_price else null 
> end) sat_sales
>  from date_dim, store_sales, store
>  where d_date_sk = ss_sold_date_sk and
>s_store_sk = ss_store_sk and
>s_gmt_offset = -6 and
>d_year = 1998 
>  group by s_store_name, s_store_id
>  order by s_store_name, 
> s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales
>  limit 100;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (HIVE-20850) Puse case conditional from projections to dimension tables if possible

2018-10-31 Thread Zoltan Haindrich (JIRA)


[ 
https://issues.apache.org/jira/browse/HIVE-20850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16670863#comment-16670863
 ] 

Zoltan Haindrich commented on HIVE-20850:
-

Apparently {{HiveProjectJoinTransposeRule}} is already able to extract the 
expression from the condition - and the cbo plans which are  [using 
contraints|https://github.com/apache/hive/blob/4b40f7d2b35df26af773ec138fdf521231792cdf/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query43.q.out#L55]
 already push these beyond the join - but [without 
constraints|https://github.com/apache/hive/blob/4b40f7d2b35df26af773ec138fdf521231792cdf/ql/src/test/results/clientpositive/perf/tez/cbo_query43.q.out#L49]
 the rule is not in action.

I'll try to enable enable it globally.

> Puse case conditional from projections to dimension tables if possible
> --
>
> Key: HIVE-20850
> URL: https://issues.apache.org/jira/browse/HIVE-20850
> Project: Hive
>  Issue Type: Improvement
>Reporter: Zoltan Haindrich
>Assignee: Zoltan Haindrich
>Priority: Major
> Attachments: HIVE-20850.01.patch
>
>
> noticed by [~gopalv]: If there is a project which could be only evaluated 
> after the join; but the condition references only a single column from a 
> small dimension table; hive will end up evaluating the same thing over and 
> over again...
> {code}
> explain
> select  s_store_name, s_store_id,
> sum(case when (d_day_name='Sunday') then ss_sales_price else null 
> end) sun_sales,
> sum(case when (d_day_name='Monday') then ss_sales_price else null 
> end) mon_sales,
> sum(case when (d_day_name='Tuesday') then ss_sales_price else  null 
> end) tue_sales,
> sum(case when (d_day_name='Wednesday') then ss_sales_price else null 
> end) wed_sales,
> sum(case when (d_day_name='Thursday') then ss_sales_price else null 
> end) thu_sales,
> sum(case when (d_day_name='Friday') then ss_sales_price else null 
> end) fri_sales,
> sum(case when (d_day_name='Saturday') then ss_sales_price else null 
> end) sat_sales
>  from date_dim, store_sales, store
>  where d_date_sk = ss_sold_date_sk and
>s_store_sk = ss_store_sk and
>s_gmt_offset = -6 and
>d_year = 1998 
>  group by s_store_name, s_store_id
>  order by s_store_name, 
> s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales
>  limit 100;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)