You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/09/10 00:21:58 UTC

[GitHub] [hive] saihemanth-cloudera commented on a change in pull request #2442: HIVE-25303: CTAS query will result in external table with data under external path when CTAS hive.create.as.external.legacy is set or transactional=false

saihemanth-cloudera commented on a change in pull request #2442:
URL: https://github.com/apache/hive/pull/2442#discussion_r705807353



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java
##########
@@ -472,6 +474,28 @@ private void setLoadFileLocation(
       loc = cmv.getLocation();
     }
     Path location = (loc == null) ? getDefaultCtasLocation(pCtx) : new Path(loc);
+    if (pCtx.getQueryProperties().isCTAS()) {
+      boolean isExternal = pCtx.getCreateTable().isExternal();
+      boolean isAcid = pCtx.getCreateTable().getTblProps().getOrDefault(
+              hive_metastoreConstants.TABLE_IS_TRANSACTIONAL, "false").equalsIgnoreCase("true") ||
+              pCtx.getCreateTable().getTblProps().containsKey(hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES);
+      if ((HiveConf.getBoolVar(conf, HiveConf.ConfVars.CREATE_TABLE_AS_EXTERNAL) || isExternal) && !isAcid) {

Review comment:
       Two reasons I don't want to remove this condition.
   1) If we can have this condition we can avoid calling the HMS dry run api, if the tables are managed tables (which is the current behavior).
   2) Only HS2 would know if hive.create.as.external.legacy config, so this condition should be in HS2
   3) L#486 is introducing buckerting_version table parameter in the explain plan for all the tables. Even if I hide it in L#492 this paramter would be missing in the describe/explain table commands. It is failing few tests. 
   So I think this should be ok leaving this condition.




-- 
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: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org