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 2022/05/16 09:39:30 UTC

[GitHub] [hive] pvary commented on a diff in pull request #3281: HIVE-26217: Make CTAS use Direct Insert Semantics

pvary commented on code in PR #3281:
URL: https://github.com/apache/hive/pull/3281#discussion_r873524614


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7592,6 +7594,22 @@ protected Operator genFileSinkPlan(String dest, QB qb, Operator input)
 
       destTableIsTransactional = tblProps != null && AcidUtils.isTablePropertyTransactional(tblProps);
       if (destTableIsTransactional) {
+        isNonNativeTable = AcidUtils.isNonNativeTable(tblProps);
+        boolean isCtas = tblDesc != null && tblDesc.isCTAS();
+        if (AcidUtils.isInsertOnlyTable(tblProps, true)) {
+          isMmTable = isMmCreate = true;
+        }
+        if (!isNonNativeTable && !destTableIsTemporary && isCtas) {
+          destTableIsFullAcid = AcidUtils.isFullAcidTable(tblProps);
+          acidOperation = getAcidType(dest);
+          isDirectInsert = isDirectInsert(destTableIsFullAcid, acidOperation);
+          boolean enableSuffixing = conf.getBoolVar(ConfVars.HIVE_ACID_CREATE_TABLE_USE_SUFFIX)
+                  || conf.getBoolVar(ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
+          if (isDirectInsert || isMmTable) {
+            String location = tblDesc.getLocation();
+            destinationPath = location == null ? getCTASDestinationTableLocation(tblDesc, enableSuffixing) : new Path(location);

Review Comment:
   How would this handle the `MetadataTransformer`s? These Transformers could alter the table location (external/managed directory changes, etc)



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