[ 
https://issues.apache.org/jira/browse/HIVE-26217?focusedWorklogId=774965&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-774965
 ]

ASF GitHub Bot logged work on HIVE-26217:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/May/22 10:26
            Start Date: 26/May/22 10:26
    Worklog Time Spent: 10m 
      Work Description: SourabhBadhya commented on code in PR #3281:
URL: https://github.com/apache/hive/pull/3281#discussion_r882532032


##########
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 = MetaStoreUtils.isNonNativeTable(tblProps);
+        boolean isCtas = tblDesc != null && tblDesc.isCTAS();
+        isMmTable = isMmCreate = AcidUtils.isInsertOnlyTable(tblProps);
+        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) {
+            destinationPath = getCTASDestinationTableLocation(tblDesc, 
enableSuffixing);
+            // Setting the location so that metadata transformers
+            // does not change the location later while creating the table.
+            tblDesc.setLocation(destinationPath.toString());

Review Comment:
   I have added the check here which adds the SOFT_DELETE_TABLE property when 
the location is suffixed.
   
https://github.com/apache/hive/pull/3281/files#diff-d4b1a32bbbd9e283893a6b52854c7aeb3e356a1ba1add2c4107e52901ca268f9R7614-R7615





Issue Time Tracking
-------------------

    Worklog Id:     (was: 774965)
    Time Spent: 5h 10m  (was: 5h)

> Make CTAS use Direct Insert Semantics
> -------------------------------------
>
>                 Key: HIVE-26217
>                 URL: https://issues.apache.org/jira/browse/HIVE-26217
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Sourabh Badhya
>            Assignee: Sourabh Badhya
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5h 10m
>  Remaining Estimate: 0h
>
> CTAS on transactional tables currently does a copy from staging location to 
> table location. This can be avoided by using Direct Insert semantics. Added 
> support for suffixed table locations as well.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to