deniskuzZ commented on code in PR #5076:
URL: https://github.com/apache/hive/pull/5076#discussion_r1523054231


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java:
##########
@@ -1720,6 +1723,41 @@ protected static MoveWork mergeMovePaths(Path 
condInputPath, MoveWork linkedMove
     return newWork;
   }
 
+  private static void 
setStorageHandlerAndPropertiesForMerge(ConditionalResolverMergeFilesCtx mrCtx, 
MoveWork work) {
+    Properties storageHandlerProperties = null;
+    String storageHandlerClass = null;
+    if (work.getLoadTableWork() != null) {
+      // Get the info from the table data
+      TableDesc tableDesc = work.getLoadTableWork().getTable();
+      storageHandlerClass = tableDesc.getProperties().getProperty(
+              
org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE);
+      storageHandlerProperties = new Properties(tableDesc.getProperties());
+    } else {
+      // Get the info from the create table data
+      CreateTableDesc createTableDesc = 
work.getLoadFileWork().getCtasCreateTableDesc();
+      String location = null;
+      if (createTableDesc != null) {
+        storageHandlerClass = createTableDesc.getStorageHandler();
+        storageHandlerProperties = new Properties();
+        storageHandlerProperties.put(hive_metastoreConstants.META_TABLE_NAME, 
createTableDesc.getDbTableName());
+        location = createTableDesc.getLocation();
+      } else {
+        CreateMaterializedViewDesc createViewDesc = 
work.getLoadFileWork().getCreateViewDesc();
+        if (createViewDesc != null) {
+          storageHandlerClass = createViewDesc.getStorageHandler();
+          storageHandlerProperties = new Properties();
+          
storageHandlerProperties.put(hive_metastoreConstants.META_TABLE_NAME, 
createViewDesc.getViewName());
+          location = createViewDesc.getLocation();
+        }
+      }
+      if (location != null) {
+        
storageHandlerProperties.put(hive_metastoreConstants.META_TABLE_LOCATION, 
location);
+      }
+    }
+    mrCtx.setStorageHandlerProps(storageHandlerProperties);

Review Comment:
   mrCtx.`setTaskProperties`(mergeTaskProperties)



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to