You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Vineet Garg (JIRA)" <ji...@apache.org> on 2018/12/03 19:06:00 UTC

[jira] [Commented] (HIVE-20996) MV rewriting not triggering

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

Vineet Garg commented on HIVE-20996:
------------------------------------

[~jcamachorodriguez] Why should the query be rewritten using materialized view? Constraints optimization ends up removing group by in this case and the query is equivalent to simple select so I don't see what is the benefit of using materialized view here?

> MV rewriting not triggering
> ---------------------------
>
>                 Key: HIVE-20996
>                 URL: https://issues.apache.org/jira/browse/HIVE-20996
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Vineet Garg
>            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)