public TablePreviewModel getPreviewData(PartitionModel model)
throws GwtException {
try {
TablePreviewModel result;
String path = model.getPath();
JobContext jobContext = JobContext.getTempJobContext();
jobContext.setProperties(new HierarchyProperties(
new HashMap<String, String>()));
jobContext.getProperties().setProperty("preview.hdfs.path", path);
jobContext.getProperties().setProperty("preview.hdfs.inputFormat",
model.getInputFormat());
jobContext.getProperties().setProperty("preview.hdfs.isCompressed",
String.valueOf(model.isCompressed()));
Profile profile = profileManager.findByUid(LoginUser.getUser()
.getUid());
if (profile != null) {
String ugi = profile.getHadoopConf().get(
"hadoop.hadoop.job.ugi");
jobContext.getProperties().setProperty(
"preview.hadoop.job.ugi", ugi);
}
DataPreviewJob job = new DataPreviewJob(jobContext);
job.run();
String logContent = job.getJobContext().getJobHistory().getLog()