This is an automated email from the ASF dual-hosted git repository.

dkuzmenko 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 35cb0a3c204 HIVE-26466: NullPointerException on 
HiveQueryLifeTimeHook:checkAndRollbackCTAS (Butao Zhang, reviewed by Denys 
Kuzmenko)
35cb0a3c204 is described below

commit 35cb0a3c204489cb5d5790080151293b9d13c4ce
Author: Butao Zhang <[email protected]>
AuthorDate: Tue Aug 16 18:13:05 2022 +0800

    HIVE-26466: NullPointerException on 
HiveQueryLifeTimeHook:checkAndRollbackCTAS (Butao Zhang, reviewed by Denys 
Kuzmenko)
    
    Closes #3515
---
 ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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 1f4219ba42e..3e125da0845 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java
@@ -37,6 +37,8 @@ import static 
org.apache.hadoop.hive.common.AcidConstants.SOFT_DELETE_TABLE_PATT
 import static 
org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.IF_PURGE;
 import static 
org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_LOCATION;
 
+import java.util.Optional;
+
 public class HiveQueryLifeTimeHook implements QueryLifeTimeHook {
 
   private static final Logger LOG = 
LoggerFactory.getLogger(HiveQueryLifeTimeHook.class);
@@ -66,7 +68,8 @@ public class HiveQueryLifeTimeHook implements 
QueryLifeTimeHook {
   private void checkAndRollbackCTAS(QueryLifeTimeHookContext ctx) {
     HiveConf conf = ctx.getHiveConf();
     QueryPlan queryPlan = ctx.getHookContext().getQueryPlan();
-    boolean isCTAS = queryPlan.getQueryProperties().isCTAS();
+    boolean isCTAS = Optional.ofNullable(queryPlan.getQueryProperties())
+        .map(queryProps -> queryProps.isCTAS()).orElse(false);
 
     PrivateHookContext pCtx = (PrivateHookContext) ctx.getHookContext();
     Path tblPath = pCtx.getContext().getLocation();

Reply via email to