zhangbutao created HIVE-27565:
---------------------------------
Summary: Fix NPE when dropping table in
HiveQueryLifeTimeHook::checkAndRollbackCTAS
Key: HIVE-27565
URL: https://issues.apache.org/jira/browse/HIVE-27565
Project: Hive
Issue Type: Bug
Reporter: zhangbutao
If dropping a iceberg table which is used by a materialized view,
HiveQueryLifeTimeHook::checkAndRollbackCTAS will throw NPE.
Step to repro:
* create a iceberg table:
create table test_ice1 (id int) stored by iceberg;
* create a materialized view:
create materialized view ice_mat1 as select * from test_ice1;
* drop the iceberg table:
drop table test_ice01;
{code:java}
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291]
at
org.apache.hadoop.hive.metastore.HiveMetaStoreClient$SynchronizedHandler.invoke(HiveMetaStoreClient.java:4462)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at com.sun.proxy.$Proxy47.dropTable(Unknown Source) ~[?:?]
at org.apache.hadoop.hive.ql.metadata.Hive.dropTable(Hive.java:1500)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
... 26 more
ERROR : FAILED: Execution Error, return code 40000 from
org.apache.hadoop.hive.ql.ddl.DDLTask. MetaException(message:Cannot drop table
as it is used in the following materialized views [testdbpr.ice_mat1]
)
WARN : Failed when invoking query after execution hook
java.lang.RuntimeException: Not able to check whether the CTAS table directory
exists due to:
at
org.apache.hadoop.hive.ql.HiveQueryLifeTimeHook.checkAndRollbackCTAS(HiveQueryLifeTimeHook.java:84)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
org.apache.hadoop.hive.ql.HiveQueryLifeTimeHook.afterExecution(HiveQueryLifeTimeHook.java:65)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
org.apache.hadoop.hive.ql.HookRunner.runAfterExecutionHook(HookRunner.java:185)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at org.apache.hadoop.hive.ql.Executor.cleanUp(Executor.java:525)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at org.apache.hadoop.hive.ql.Executor.execute(Executor.java:118)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:367)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:205)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:154)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:149)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:185)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:236)
~[hive-service-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
org.apache.hive.service.cli.operation.SQLOperation.access$500(SQLOperation.java:90)
~[hive-service-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.run(SQLOperation.java:336)
~[hive-service-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at java.security.AccessController.doPrivileged(Native Method)
~[?:1.8.0_291]
at javax.security.auth.Subject.doAs(Subject.java:422) ~[?:1.8.0_291]
at
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1878)
~[hadoop-common-3.3.1.jar:?]
at
org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.run(SQLOperation.java:356)
~[hive-service-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
~[?:1.8.0_291]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
~[?:1.8.0_291]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
~[?:1.8.0_291]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
~[?:1.8.0_291]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_291]
Caused by: java.lang.NullPointerException
at
org.apache.hadoop.hive.ql.HiveQueryLifeTimeHook.checkAndRollbackCTAS(HiveQueryLifeTimeHook.java:79)
~[hive-exec-4.0.0-beta-1-SNAPSHOT.jar:4.0.0-beta-1-SNAPSHOT]
... 21 more
INFO : Completed executing
command(queryId=hive_20230804145734_08837e22-5ff0-4b56-a0cf-69b0414171dd); Time
taken: 0.073 seconds
Error: Error while compiling statement: FAILED: Execution Error, return code
40000 from org.apache.hadoop.hive.ql.ddl.DDLTask. MetaException(message:Cannot
drop table as it is used in the following materialized views [testdbpr.ice_mat1]
) (state=08S01,code=40000)
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)