[
https://issues.apache.org/jira/browse/HIVE-26217?focusedWorklogId=776239&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-776239
]
ASF GitHub Bot logged work on HIVE-26217:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 31/May/22 10:56
Start Date: 31/May/22 10:56
Worklog Time Spent: 10m
Work Description: deniskuzZ commented on code in PR #3281:
URL: https://github.com/apache/hive/pull/3281#discussion_r885496096
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/TaskCompiler.java:
##########
@@ -517,17 +517,21 @@ private Path getDefaultCtasLocation(final ParseContext
pCtx) throws SemanticExce
try {
String protoName = null, suffix = "";
boolean isExternal = false;
-
+ boolean useSuffix = HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_CREATE_TABLE_USE_SUFFIX)
+ || HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
+
if (pCtx.getQueryProperties().isCTAS()) {
protoName = pCtx.getCreateTable().getDbTableName();
isExternal = pCtx.getCreateTable().isExternal();
-
+ if (!isExternal && useSuffix) {
+ long txnId = Optional.ofNullable(pCtx.getContext())
+ .map(ctx ->
ctx.getHiveTxnManager().getCurrentTxnId()).orElse(0L);
+ suffix = SOFT_DELETE_PATH_SUFFIX + String.format(DELTA_DIGITS,
txnId);
+ }
} else if (pCtx.getQueryProperties().isMaterializedView()) {
protoName = pCtx.getCreateViewDesc().getViewName();
- boolean createMVUseSuffix = HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_CREATE_TABLE_USE_SUFFIX)
- || HiveConf.getBoolVar(conf,
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED);
- if (createMVUseSuffix) {
+ if (useSuffix) {
long txnId = Optional.ofNullable(pCtx.getContext())
.map(ctx -> ctx.getHiveTxnManager().getCurrentTxnId()).orElse(0L);
suffix = SOFT_DELETE_PATH_SUFFIX + String.format(DELTA_DIGITS,
txnId);
Review Comment:
shouldn't be populating suffix if txnId=0
Issue Time Tracking
-------------------
Worklog Id: (was: 776239)
Time Spent: 10h 50m (was: 10h 40m)
> 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: 10h 50m
> 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)