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

Invalid materialized view after rebuild if source table was compacted

    XMLWordPrintableJSON

Details

    Description

      After HIVE-25656 MV state depends on the number of rows deleted/updated in the source tables of the view. However if one of the source tables are major compacted the delete delta files are no longer available and reproducing the rows should be deleted from the MV is no longer possible.

      create table t1(a int, b varchar(128), c float) stored as orc TBLPROPERTIES ('transactional'='true');
      insert into t1(a,b, c) values (1, 'one', 1.1), (2, 'two', 2.2), (NULL, NULL, NULL);
      create materialized view mv1 stored as orc TBLPROPERTIES ('transactional'='true') as select a,b,c from t1 where a > 0 or a is null;
      update t1 set b = 'Changed' where a = 1;
      alter table t1 compact 'major';
      alter materialized view t1 rebuild;
      select * from mv1;
      

      Select should result

            "1\tChanged\t1.1",
            "2\ttwo\t2.2",
            "NULL\tNULL\tNULL"
      

      but was

            "1\tone\t1.1",      
            "2\ttwo\t2.2",
            "NULL\tNULL\tNULL",
            "1\tChanged\t1.1"
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m