deniskuzZ commented on code in PR #3281:
URL: https://github.com/apache/hive/pull/3281#discussion_r885472281
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7598,6 +7602,26 @@ 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 = HiveConf.getBoolVar(conf,
ConfVars.HIVE_ACID_CREATE_TABLE_USE_SUFFIX)
+ || HiveConf.getBoolVar(conf,
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());
+ // Property SOFT_DELETE_TABLE needs to be added to indicate that
suffixing is used.
+ if (enableSuffixing && tblDesc.getLocation().matches("(.*)" +
SOFT_DELETE_TABLE_PATTERN)) {
Review Comment:
can't we handle suffix here:
````
if (enableSuffixing) {
long txnId = ctx.getHiveTxnManager().getCurrentTxnId();
suffix = SOFT_DELETE_PATH_SUFFIX + String.format(DELTA_DIGITS, txnId)
destinationPath = new Path(destinationPath + suffix);
tblDesc.getTblProps().put(SOFT_DELETE_TABLE, Boolean.TRUE.toString());
}
````
--
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]