[
https://issues.apache.org/jira/browse/HIVE-22262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17065205#comment-17065205
]
Vineet Garg edited comment on HIVE-22262 at 3/24/20, 12:10 AM:
---------------------------------------------------------------
The reason {{HiveAggregateProjectMergeRule}} isn't able to merge is because
Project is introducing a constant expression in this case.
Following query better encapsulate the case where
{{AggregateJoinTransposeRule}} should help trigger rewriting
{code:sql}
explain cbo select pk1, dim2.fk4, sum(fk3), count(c1)
from fact, dim2
where to_date(fact.fk4) = dim2.fk4
group by pk1,dim2.fk4
order by pk1,dim2.fk4;
{code}
was (Author: vgarg):
The reason {{HiveAggregateProjectMergeRule}} isn't able to merge is because
Project is introducing a constant expression in this case.
Following query better encapsulate case where {{AggregateJoinTransposeRule}}
should help trigger rewriting
{code:sql}
explain cbo select pk1, dim2.fk4, sum(fk3), count(c1)
from fact, dim2
where to_date(fact.fk4) = dim2.fk4
group by pk1,dim2.fk4
order by pk1,dim2.fk4;
{code}
> Aggregate pushdown through join may generate additional rewriting
> opportunities
> -------------------------------------------------------------------------------
>
> Key: HIVE-22262
> URL: https://issues.apache.org/jira/browse/HIVE-22262
> Project: Hive
> Issue Type: Sub-task
> Components: CBO, Materialized views
> Affects Versions: 3.1.2
> Reporter: Steve Carlin
> Assignee: Vineet Garg
> Priority: Major
> Attachments: eager-v2.sql
>
>
> In this case, there is a function used in the query and materialized view,
> but the aggregate is not being pushed down. Script is attached.
> Example query and materialized view:
> create materialized view av1 stored as orc as select fk1, fk2, fk3,
> to_date(fk4), sum(1) from fact group by 1, 2, 3, 4;
> explain cbo select pk1, dim2.fk4, sum(1), count(c1)
> from fact, dim2
> where to_date(fact.fk4) = dim2.fk4
> group by 1, 2
> order by 1, 2;
--
This message was sent by Atlassian Jira
(v8.3.4#803005)