[
https://issues.apache.org/jira/browse/HIVE-26680?focusedWorklogId=823288&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-823288
]
ASF GitHub Bot logged work on HIVE-26680:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Nov/22 07:57
Start Date: 04/Nov/22 07:57
Worklog Time Spent: 10m
Work Description: SourabhBadhya commented on code in PR #3715:
URL: https://github.com/apache/hive/pull/3715#discussion_r1013714860
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7610,30 +7610,44 @@ protected Operator genFileSinkPlan(String dest, QB qb,
Operator input)
destTableIsMaterialization = false;
tableName =
HiveTableName.ofNullableWithNoDefault(viewDesc.getViewName());
tblProps = viewDesc.getTblProps();
+ // Add suffix only when required confs are present
+ // and user has not specified a location to the table.
+ createTableUseSuffix = (HiveConf.getBoolVar(conf,
ConfVars.HIVE_ACID_CREATE_TABLE_USE_SUFFIX)
+ || HiveConf.getBoolVar(conf,
ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED))
+ && viewDesc.getLocation() == null;
}
destTableIsTransactional = tblProps != null &&
AcidUtils.isTablePropertyTransactional(tblProps);
if (destTableIsTransactional) {
isNonNativeTable = MetaStoreUtils.isNonNativeTable(tblProps);
boolean isCtas = tblDesc != null && tblDesc.isCTAS();
+ boolean isCMV = viewDesc != null && qb.isMaterializedView();
isMmTable = isMmCreate = AcidUtils.isInsertOnlyTable(tblProps);
- if (!isNonNativeTable && !destTableIsTemporary && isCtas) {
+ if (!isNonNativeTable && !destTableIsTemporary && (isCtas || isCMV)) {
destTableIsFullAcid = AcidUtils.isFullAcidTable(tblProps);
acidOperation = getAcidType(dest);
- isDirectInsert = isDirectInsert(destTableIsFullAcid, acidOperation);
+ isDirectInsert = isDirectInsertCreate =
isDirectInsert(destTableIsFullAcid, acidOperation);
Review Comment:
Thanks for taking a look at this - @veghlaci05
This variable is required to differentiate between direct insert which is
initiated by insert commands and direct insert initiated by CTAS/CMV.
`isDirectInsertCreate` is by default false and only set when CTAS or CMV is
initiated.
Earlier there used to be a specific check for direct insert with CTAS here -
https://github.com/apache/hive/pull/3715/files#diff-d4b1a32bbbd9e283893a6b52854c7aeb3e356a1ba1add2c4107e52901ca268f9L7927-L7930
Since the idea is to set the writer only when direct insert is initiated by
CTAS or CMV, this can be achieved by using a specific variable to distinguish
between direct insert initiated by Insert commands and direct insert initiated
by CTAS/CMV.
Issue Time Tracking
-------------------
Worklog Id: (was: 823288)
Time Spent: 50m (was: 40m)
> Make CMV use Direct Insert Semantics
> ------------------------------------
>
> Key: HIVE-26680
> URL: https://issues.apache.org/jira/browse/HIVE-26680
> Project: Hive
> Issue Type: Improvement
> Reporter: Sourabh Badhya
> Assignee: Sourabh Badhya
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> As similar to CTAS, CMV can also use Direct Insert approach which can
> potentially save a lot of filesystem operations.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)