} else {
// First we generate the move work as this needs to be made dependent on all
// the tasks that have a file sink operation
List<moveWork> mv = new ArrayList<moveWork>();
for (loadTableDesc ltd : loadTableWork)
mvTask.add(TaskFactory.get(new moveWork(null, null, ltd, null, false), this.conf));
boolean oneLoadFile = true;
for (loadFileDesc lfd : loadFileWork) {
if ( qb.isCTAS() ) {
assert(oneLoadFile); // should not have more than 1 load file for CTAS
// make the movetask's destination directory the table's destination.
String location = qb.getTableDesc().getLocation();
if ( location == null ) {
// get the table's default location
location = conf.getVar(HiveConf.ConfVars.METASTOREWAREHOUSE);
assert(location.length() > 0 );
if ( location.charAt(location.length()-1) != '/' ) {
location += '/';
}
location += qb.getTableDesc().getTableName().toLowerCase();
}
lfd.setTargetDir(location);
oneLoadFile = false;
}
mvTask.add(TaskFactory.get(new moveWork(null, null, null, lfd, false), this.conf));
}
}
// generate map reduce plans
GenMRProcContext procCtx =