zhangbutao commented on code in PR #4549:
URL: https://github.com/apache/hive/pull/4549#discussion_r1284290220


##########
ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java:
##########
@@ -71,20 +71,23 @@ private void checkAndRollbackCTAS(QueryLifeTimeHookContext 
ctx) {
     QueryPlan queryPlan = ctx.getHookContext().getQueryPlan();
     boolean isCTAS = Optional.ofNullable(queryPlan.getQueryProperties())
         .map(queryProps -> queryProps.isCTAS()).orElse(false);
+    // return early if the query is not CATS type.
+    if (!isCTAS)
+      return;
 
     PrivateHookContext pCtx = (PrivateHookContext) ctx.getHookContext();
     Path tblPath = pCtx.getContext().getLocation();
 
-    try {
-      FileSystem fs = tblPath.getFileSystem(conf);
-      if (!fs.exists(tblPath)) {
-        return;
+    if (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) {

Review Comment:
   Fixed.



##########
ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java:
##########
@@ -71,20 +71,23 @@ private void checkAndRollbackCTAS(QueryLifeTimeHookContext 
ctx) {
     QueryPlan queryPlan = ctx.getHookContext().getQueryPlan();
     boolean isCTAS = Optional.ofNullable(queryPlan.getQueryProperties())
         .map(queryProps -> queryProps.isCTAS()).orElse(false);
+    // return early if the query is not CATS type.
+    if (!isCTAS)

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to