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

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

                Author: ASF GitHub Bot
            Created on: 15/Nov/22 06:57
            Start Date: 15/Nov/22 06:57
    Worklog Time Spent: 10m 
      Work Description: SourabhBadhya commented on code in PR #3715:
URL: https://github.com/apache/hive/pull/3715#discussion_r1022383026


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7990,19 +7998,29 @@ protected boolean enableColumnStatsCollecting() {
     return true;
   }
 
-  private Path getCtasLocation(CreateTableDesc tblDesc, boolean 
createTableWithSuffix) throws SemanticException {
+  private Path getCtasOrCMVLocation(CreateTableDesc tblDesc, 
CreateMaterializedViewDesc viewDesc,
+                               boolean createTableWithSuffix) throws 
SemanticException {
     Path location;
+    String protoName;
+    String[] names;
+    Table tbl;
     try {
-      String protoName = tblDesc.getDbTableName();
-      String[] names = Utilities.getDbTableName(protoName);
-
-      // Handle table translation initially and if not present
-      // use default table path.
-      // Property modifications of the table is handled later.
-      // We are interested in the location if it has changed
-      // due to table translation.
-      Table tbl = tblDesc.toTable(conf);
-      tbl = db.getTranslateTableDryrun(tbl.getTTable());
+      if (tblDesc != null) {
+        protoName = tblDesc.getDbTableName();
+        names = Utilities.getDbTableName(protoName);

Review Comment:
   Replaced with 
   `names = Utilities.getDbTableName(tblDesc.getDbTableName());` - For CTAS
   AND 
   `names = Utilities.getDbTableName(viewDesc.getViewName());` - For CMV
   



##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -7917,17 +7929,13 @@ protected Operator genFileSinkPlan(String dest, QB qb, 
Operator input)
         destinationPath, currentTableId, destTableIsFullAcid, 
destTableIsTemporary,//this was 1/4 acid
         destTableIsMaterialization, queryTmpdir, rsCtx, dpCtx, lbCtx, fsRS,
         canBeMerged, destinationTable, writeId, isMmCreate, destType, qb, 
isDirectInsert, acidOperation, moveTaskId);
-    if (isMmCreate) {
+    if (isMmCreate || ((qb.isCTAS() || qb.isMaterializedView()) && 
isDirectInsert)) {

Review Comment:
   Done





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

    Worklog Id:     (was: 826006)
    Time Spent: 3h 40m  (was: 3.5h)

> 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: 3h 40m
>  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)

Reply via email to