private static Task<?> loadTable(URI fromURI, ImportTableDesc tblDesc, boolean replace, Path tgtPath,
                                   ReplicationSpec replicationSpec, EximUtil.SemanticAnalyzerWrapperContext x,
                                   Long writeId, int stmtId,
                                   String dumpRoot, ReplicationMetricCollector metricCollector) throws HiveException {


    Path dataPath = new Path(fromURI.toString(), EximUtil.DATA_PATH_NAME);

    DeferredWorkContext
        resolver = new DeferredWorkContext(replace, tgtPath, writeId, stmtId, x.getHive(), x.getCtx(), tblDesc,
            replicationSpec.isInReplicationScope());

    Task<?> copyTask;
    // Corresponding work instances are not complete yet. Some of the values will be calculated and assigned when task
    // is being executed.
    if (replicationSpec.isInReplicationScope()) {
      boolean copyAtLoad = x.getConf().getBoolVar(HiveConf.ConfVars.REPL_RUN_DATA_COPY_TASKS_ON_TARGET);
      copyTask = ReplCopyTask.getLoadCopyTask(replicationSpec, dataPath, null, x.getConf(),
              false, false, copyAtLoad, dumpRoot, metricCollector);
    } else {
      copyTask = TaskFactory.get(new CopyWork(dataPath, null, false, dumpRoot, metricCollector, true));
    }

    copyTask.setDeferredWorkContext(resolver);

    MoveWork moveWork = new MoveWork(x.getInputs(), x.getOutputs(), null, null, false,
        dumpRoot, metricCollector, true);

    //if Importing into existing table, FileFormat is checked by
    // ImportSemanticAnalyzer.checked checkTable()
    Task<?> loadTableTask = TaskFactory.get(moveWork, x.getConf());
    loadTableTask.setDeferredWorkContext(resolver);
    copyTask.addDependentTask(loadTableTask);
    x.getTasks().add(copyTask);
    return loadTableTask;
  }
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