[
https://issues.apache.org/jira/browse/HIVE-25369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Krisztian Kasa updated HIVE-25369:
----------------------------------
Description:
When rewriting MV insert overwrite plan to incremental rebuild plan a Sum0
(HiveSqlSumEmptyIsZeroAggFunction) aggregate function is used when aggregating
count function subresults coming from the existing MV data and the aggregated
newly inserted/deleted records since the last rebuild
{code:java}
create materialized view mat1 stored as orc TBLPROPERTIES
('transactional'='true') as
select t1.a, count(*) from t1
{code}
Insert overwrite plan:
{code:java}
HiveAggregate(group=[{0}], agg#0=[$SUM0($1)])
HiveUnion(all=[true])
HiveAggregate(group=[{0}], agg#0=[count()])
HiveProject($f0=[$0])
HiveFilter(condition=[<(2, $5.writeid)])
HiveTableScan(table=[[default, t1]], table:alias=[t1])
HiveTableScan(table=[[default, mat1]], table:alias=[default.mat1])
{code}
was:
When rewriting MV insert overwrite plan to incremental rebuild plan a Sum0
aggregate function is used when aggregating count function subresults coming
from the existing MV data and the aggregated newly inserted/deleted records
since the last rebuild
{code}
create materialized view mat1 stored as orc TBLPROPERTIES
('transactional'='true') as
select t1.a, count(*) from t1
{code}
Insert overwrite plan:
{code}
HiveAggregate(group=[{0}], agg#0=[$SUM0($1)])
HiveUnion(all=[true])
HiveAggregate(group=[{0}], agg#0=[count()])
HiveProject($f0=[$0])
HiveFilter(condition=[<(2, $5.writeid)])
HiveTableScan(table=[[default, t1]], table:alias=[t1])
HiveTableScan(table=[[default, mat1]], table:alias=[default.mat1])
{code}
> Handle Sum0 when rebuilding materialized view incrementally
> -----------------------------------------------------------
>
> Key: HIVE-25369
> URL: https://issues.apache.org/jira/browse/HIVE-25369
> Project: Hive
> Issue Type: Improvement
> Components: CBO, Materialized views
> Reporter: Krisztian Kasa
> Assignee: Krisztian Kasa
> Priority: Major
>
> When rewriting MV insert overwrite plan to incremental rebuild plan a Sum0
> (HiveSqlSumEmptyIsZeroAggFunction) aggregate function is used when
> aggregating count function subresults coming from the existing MV data and
> the aggregated newly inserted/deleted records since the last rebuild
> {code:java}
> create materialized view mat1 stored as orc TBLPROPERTIES
> ('transactional'='true') as
> select t1.a, count(*) from t1
> {code}
> Insert overwrite plan:
> {code:java}
> HiveAggregate(group=[{0}], agg#0=[$SUM0($1)])
> HiveUnion(all=[true])
> HiveAggregate(group=[{0}], agg#0=[count()])
> HiveProject($f0=[$0])
> HiveFilter(condition=[<(2, $5.writeid)])
> HiveTableScan(table=[[default, t1]], table:alias=[t1])
> HiveTableScan(table=[[default, mat1]], table:alias=[default.mat1])
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)