This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new a901668bb81 HIVE-27565: Fix NPE when dropping table in
HiveQueryLifeTimeHook::checkAndRollbackCTAS (#4549). (zhangbutao, reviewed by
Ayush Saxena, Sourabh Badhya)
a901668bb81 is described below
commit a901668bb810366f1a8dd75e81a6077fdb0e08f3
Author: Butao Zhang <[email protected]>
AuthorDate: Mon Aug 7 16:31:55 2023 +0800
HIVE-27565: Fix NPE when dropping table in
HiveQueryLifeTimeHook::checkAndRollbackCTAS (#4549). (zhangbutao, reviewed by
Ayush Saxena, Sourabh Badhya)
---
.../org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java
b/ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java
index a32a81e6f23..82a3f190000 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java
@@ -75,16 +75,16 @@ public class HiveQueryLifeTimeHook implements
QueryLifeTimeHook {
PrivateHookContext pCtx = (PrivateHookContext) ctx.getHookContext();
Path tblPath = pCtx.getContext().getLocation();
- try {
- FileSystem fs = tblPath.getFileSystem(conf);
- if (!fs.exists(tblPath)) {
- return;
+ if (isCTAS && tblPath != null) {
+ try {
+ FileSystem fs = tblPath.getFileSystem(conf);
+ if (!fs.exists(tblPath)) {
+ return;
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Not able to check whether the CTAS table
directory exists due to: ", e);
}
- } catch (Exception e) {
- throw new RuntimeException("Not able to check whether the CTAS table
directory exists due to: ", e);
- }
- if (isCTAS && tblPath != null) {
boolean isSoftDeleteEnabled = tblPath.getName().matches("(.*)" +
SOFT_DELETE_TABLE_PATTERN);
if ((HiveConf.getBoolVar(conf, HiveConf.ConfVars.TXN_CTAS_X_LOCK) ||
isSoftDeleteEnabled)