You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "stephbat (Jira)" <ji...@apache.org> on 2020/11/03 07:21:00 UTC

[jira] [Updated] (HIVE-24218) Drop table used by a materialized view

     [ https://issues.apache.org/jira/browse/HIVE-24218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stephbat updated HIVE-24218:
----------------------------
    Component/s: Hive

> Drop table used by a materialized view
> --------------------------------------
>
>                 Key: HIVE-24218
>                 URL: https://issues.apache.org/jira/browse/HIVE-24218
>             Project: Hive
>          Issue Type: Bug
>          Components: CLI, Hive, Metastore
>    Affects Versions: 3.1.0
>            Reporter: stephbat
>            Priority: Critical
>
> I have discovered that it's possible to drop a table used by a materialized view. When I drop this table, the result is OK while I think this action should be refused. When I check in the metastore database, I can see that the table has been partially deleted (ie : the reference of the table still exists inĀ TBLS and in MV_TABLES_USED). This introduces an inconsistency in the metastore.
> Steps to reproduced :
> {code:java}
> jdbc:hive2://localhost.> use use ptest2_db_dev;
> No rows affected (0.067 seconds)
> 0: jdbc:hive2://localhost.> create table table_blocked (id string);
> No rows affected (0.97 seconds)
> 0: jdbc:hive2://localhost.> desc table_blocked;
> +-----------+------------+----------+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+
> | id        | string     |          |
> +-----------+------------+----------+
> 1 row selected (0.171 seconds)
> 0: jdbc:hive2://localhost.> create materialized view table_blocked_mv as select * from table_blocked;
> No rows affected (18.055 seconds)
> 0: jdbc:hive2://localhost.> desc table_blocked_mv;
> +-----------+------------+----------+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+
> | id        | string     |          |
> +-----------+------------+----------+
> 1 row selected (0.316 seconds)
> 0: jdbc:hive2://localhost.> drop table table_blocked;
> No rows affected (10.803 seconds)
> 0: jdbc:hive2://localhost.> desc table_blocked_mv;
> +-----------+------------+----------+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+
> | id        | string     |          |
> +-----------+------------+----------+
> 1 row selected (0.222 seconds)
> 0: jdbc:hive2://localhost.> desc table_blocked;
> Error: Error while compiling statement: FAILED: SemanticException Unable to fetch table table_blocked. null (state=42000,code=40000)
> 0: jdbc:hive2://localhost.> select * from table_blocked_mv;
> Error: Error while compiling statement: FAILED: SemanticException Table ptest2_db_dev.table_blocked not found when trying to obtain it to check masking/filtering policies (state=42000,code=40000)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)