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

Hive does not check for dependent materialized views when issuing a DROP TABLE command

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 3.1.0
    • Fix Version/s: None
    • Component/s: Materialized views
    • Labels:
      None
    • Flags:
      Important

      Description

      Dropping a table leads to undefined behavior when that table is the source of an existing materialized view. The following behavior is observed:
       

      • Table still appears in 'show tables' despite not being in metastore
      • Actions on table hang and then display a "could not fetch table" error
      • Rebuilding any dependent materialized view has same error

      It seems that the root cause is the fact that users are allowed to issue a DROP TABLE command against a table even if there is a materialized view using this table at the time. This is not something I have seen other query languages permit. 

      Repro steps: Launch these commands from any Hive 3 client:

      create table footable (id int); insert into footable values (1), (2), (3);
      create materialized view mv_footable as select count(*) from footable;
      drop table footable;
      
      --These lines have unexpected behavior
      show tables;
      select * from footable;
      alter materialized view mv_footable rebuild;

        Attachments

          Activity

            People

            • Assignee:
              msft-tacox Taylor Cox
              Reporter:
              msft-tacox Taylor Cox
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: