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

Jesus Camacho Rodriguez commented on HIVE-20996:
------------------------------------------------

[~vgarg], the default costing model favors selecting plans with MV rewriting. 
If both plans are the same, then I would expect the planner to choose the MV 
plan, as it should have lower cost. However, that is not case, hence at least 
we need to know why. It may be that it is something trivial, e.g., the 
rewriting rule does not match Project-TS because it is a very simple pattern 
and it was not added.

> MV rewriting not triggering
> ---------------------------
>
>                 Key: HIVE-20996
>                 URL: https://issues.apache.org/jira/browse/HIVE-20996
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Vineet Garg
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>
> {code:sql}
> set hive.support.concurrency=true;
> set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
> set hive.strict.checks.cartesian.product=false;
> set hive.stats.fetch.column.stats=true;
> set hive.materializedview.rewriting=true;
> create table emps_n3 (
>   empid int,
>   deptno int,
>   name varchar(256),
>   salary float,
>   commission int)
> stored as orc TBLPROPERTIES ('transactional'='true');
> insert into emps_n3 values (100, 10, 'Bill', 10000, 1000), (200, 20, 'Eric', 
> 8000, 500),
>   (150, 10, 'Sebastian', 7000, null), (110, 10, 'Theodore', 10000, 250), 
> (120, 10, 'Bill', 10000, 250);
> analyze table emps_n3 compute statistics for columns;
> alter table emps_n3 add constraint pk1 primary key (empid) disable novalidate 
> rely;
> create materialized view mv1_n2 as
> select empid, deptno from emps_n3 group by empid, deptno;
> explain
> select empid, deptno from emps_n3 group by empid, deptno;
> {code}



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

Reply via email to