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


##########
ql/src/java/org/apache/hadoop/hive/ql/HiveQueryLifeTimeHook.java:
##########
@@ -75,13 +75,15 @@ private void checkAndRollbackCTAS(QueryLifeTimeHookContext 
ctx) {
     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);

Review Comment:
    > you mean to say this method gets invoked for non CTAS queries as well?
   
   Yse, In my case HIVE-27565 which is `Drop` type , also invoked 
`checkAndRollbackCTAS(QueryLifeTimeHookContext ctx)`. But i think this method 
is only for handling `CTAS` type queries, so other queries should return early 
to leave the method.
   
   I will refine the PR to return early if the query is not `CTAS`.



-- 
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