private static Path getTableDataLocation(Warehouse wh, Table destTable, ImportTableDesc tblDesc,
      EximUtil.SemanticAnalyzerWrapperContext x) throws HiveException, MetaException {
    if (tblDesc.getLocation() != null) {
      // If the import has specified the target location, use it.
      // The partition can be imported to a customized location.
      return new Path(tblDesc.getLocation());
    } else if (destTable != null && destTable.getDataLocation() != null) {
      // If the import table is existing, use the table location
      return destTable.getDataLocation();
    } else {
      // For import new table
      Table translatedTable = x.getHive().getTranslateTableDryrun(tblDesc.toTable(x.getConf()).getTTable());
      Path tablePath = translatedTable.getDataLocation();
      if (tablePath == null) {
        Database parentDb = x.getHive().getDatabase(tblDesc.getDatabaseName());
        tablePath = wh.getDefaultTablePath(parentDb, tblDesc.getTableName(), tblDesc.isExternal());
      }
      return tablePath;
    }
  }
Utility method that returns a table if one corresponding to the destination
tblDesc is found. Returns null if no such table is found.
ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java