private static AlterTableAddPartitionDesc getBaseAddPartitionDescFromPartition(Path fromPath, String dbName,
      ImportTableDesc tblDesc, Partition partition, ReplicationSpec replicationSpec, HiveConf conf)
          throws MetaException, SemanticException {
    Map<String, String> partitionSpec = EximUtil.makePartSpec(tblDesc.getPartCols(), partition.getValues());

    StorageDescriptor sd = partition.getSd();

    String location = null;
    if (replicationSpec.isInReplicationScope() && tblDesc.isExternal()) {
      location = ReplExternalTables.externalTableLocation(conf, partition.getSd().getLocation());
      LOG.debug("partition {} has data location: {}", partition, location);
    } else {
      location = new Path(fromPath, Warehouse.makePartName(tblDesc.getPartCols(), partition.getValues())).toString();
    }

    long writeId = -1;
    if (tblDesc.getReplWriteId() != null) {
      writeId = tblDesc.getReplWriteId();
    }

    AlterTableAddPartitionDesc.PartitionDesc partitionDesc = new AlterTableAddPartitionDesc.PartitionDesc(
        partitionSpec, location, partition.getParameters(), sd.getInputFormat(), sd.getOutputFormat(),
        sd.getNumBuckets(), sd.getCols(), sd.getSerdeInfo().getSerializationLib(), sd.getSerdeInfo().getParameters(),
        sd.getBucketCols(), sd.getSortCols(), null, writeId);
    return new AlterTableAddPartitionDesc(dbName, tblDesc.getTableName(), true, ImmutableList.of(partitionDesc));
  }
The same code is used from both the "repl load" as well as "import".
Given that "repl load" now supports two modes "repl load dbName [location]" and
"repl load [location]" in which case the database name has to be taken from the table metadata
by default and then over-ridden if something specified on the command line.
<p>
hence for import to work correctly we have to pass in the sessionState default Db via the
parsedDbName parameter
ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java