private static void setStorageHandlerAndProperties(ConditionalResolverMergeFilesCtx mrCtx, MoveWork work) {
    Properties mergeTaskProperties = 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);
      mergeTaskProperties = 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();
        mergeTaskProperties = new Properties();
        mergeTaskProperties.putAll(createTableDesc.getSerdeProps());
        mergeTaskProperties.put(hive_metastoreConstants.META_TABLE_NAME, createTableDesc.getDbTableName());
        location = createTableDesc.getLocation();
      } else {
        CreateMaterializedViewDesc createViewDesc = work.getLoadFileWork().getCreateViewDesc();
        if (createViewDesc != null) {
          storageHandlerClass = createViewDesc.getStorageHandler();
          mergeTaskProperties = new Properties();
          mergeTaskProperties.putAll(createViewDesc.getSerdeProps());
          mergeTaskProperties.put(hive_metastoreConstants.META_TABLE_NAME, createViewDesc.getViewName());
          location = createViewDesc.getLocation();
        }
      }
      if (location != null) {
        mergeTaskProperties.put(hive_metastoreConstants.META_TABLE_LOCATION, location);
      }
    }
    mrCtx.setTaskProperties(mergeTaskProperties);
    mrCtx.setStorageHandlerClass(storageHandlerClass);
  }
Merges the given Conditional input path and the linked MoveWork into one only MoveWork.
This is an optimization for BlobStore systems to avoid doing two renames or copies that are not necessary.

@param condInputPath A path that the ConditionalTask uses as input for its sub-tasks.
@param linkedMoveWork A MoveWork that the ConditionalTask uses to link to its sub-tasks.
@param lineageState A LineageState used to track what changes.
@return A new MoveWork that has the Conditional input path as source and the linkedMoveWork as target.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/GenMapRedUtils.java