partitions = (ts.partitions != null) ? ts.partitions : db.getPartitions(ts.tableHandle);
}
String tmpfile = ctx.getLocalTmpFileURI();
Path path = new Path(tmpfile, "_metadata");
EximUtil.createExportDump(FileSystem.getLocal(conf), path, ts.tableHandle, partitions);
Task<? extends Serializable> rTask = TaskFactory.get(new CopyWork(
path.toString(), toURI.toString(), false), conf);
rootTasks.add(rTask);
LOG.debug("_metadata file written into " + path.toString()
+ " and then copied to " + toURI.toString());
} catch (Exception e) {
throw new SemanticException(
ErrorMsg.GENERIC_ERROR
.getMsg("Exception while writing out the local file"), e);
}
if (ts.tableHandle.isPartitioned()) {
for (Partition partition : partitions) {
URI fromURI = partition.getDataLocation();
Path toPartPath = new Path(toURI.toString(), partition.getName());
Task<? extends Serializable> rTask = TaskFactory.get(
new CopyWork(fromURI.toString(), toPartPath.toString(), false),
conf);
rootTasks.add(rTask);
inputs.add(new ReadEntity(partition));
}
} else {
URI fromURI = ts.tableHandle.getDataLocation();
Path toDataPath = new Path(toURI.toString(), "data");
Task<? extends Serializable> rTask = TaskFactory.get(new CopyWork(
fromURI.toString(), toDataPath.toString(), false), conf);
rootTasks.add(rTask);
inputs.add(new ReadEntity(ts.tableHandle));
}
outputs.add(new WriteEntity(toURI.toString(),