Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-28006

Materialized view with aggregate function incorrectly shows it allows incremental rebuild

    XMLWordPrintableJSON

Details

    Description

      set hive.support.concurrency=true;
      set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
      
      create table store_sales (
        ss_sold_date_sk int,
        ss_ext_sales_price int,
        ss_customer_sk int
      ) stored as orc TBLPROPERTIES ('transactional'='true');
      
      insert into store_sales (ss_sold_date_sk, ss_ext_sales_price, ss_customer_sk) values (2, 2, 2);
      
      create materialized view mat1 stored as orc tblproperties ('format-version'='2') as
      select ss_customer_sk
            ,min(ss_ext_sales_price)
            ,count(*)
       from store_sales
       group by ss_customer_sk;
      
      delete from store_sales where ss_sold_date_sk = 1;
      
      show materialized views;
      
      explain cbo
      alter materialized view mat1 rebuild;
      

      Incremental rebuild is available

      # MV Name           	Rewriting Enabled   	Mode                	Incremental rebuild 
      mat1                	Yes                 	Manual refresh      	Available           
      

      vs full rebuild plan

      CBO PLAN:
      HiveAggregate(group=[{2}], agg#0=[min($1)], agg#1=[count()])
        HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
      

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              kkasa Krisztian Kasa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: