use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class Partition method append.
public void append(Writable o) throws WindowingException {
try {
elems.append(o);
sz++;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class QueryOutputPrinter method printQueryOutput.
@SuppressWarnings({ "unchecked", "rawtypes" })
public void printQueryOutput(QueryDef qry, HiveConf cfg) throws WindowingException {
try {
JobConf jCfg = new JobConf(cfg);
SerDe outSerDe = setupOutputSerDe(qry, jCfg);
RowSchema rSchema = getQueryOutputRowSchema(qry, jCfg);
TableDesc tDesc = setupTableDesc(rSchema);
tDesc.setDeserializerClass(qry.getOutput().getSerDe().getClass());
String outputFormatClassName = qry.getOutput().getSpec().getOutputFormatClass();
Class<? extends OutputFormat> outputFormatClass = (outputFormatClassName != null) ? (Class<? extends OutputFormat>) Class.forName(outputFormatClassName) : SequenceFileOutputFormat.class;
// todo this is hack; check how this is done in Hive
tDesc.setInputFileFormatClass(mapToInputFormat(outputFormatClass));
tDesc.setProperties(qry.getOutput().getSpec().getSerDeProps());
FetchOperator ftOp = setupFetchOperator(qry, tDesc, jCfg);
while (true) {
InspectableObject io = ftOp.getNextRow();
if (io == null) {
return;
}
String s = ((Text) outSerDe.serialize(io.o, io.oi)).toString();
printOutput(s);
}
} catch (WindowingException we) {
throw we;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class MRExecutor method execute.
/*
* Create a MapRedWork object and an operator tree
* for processing queries with table functions.
* Execute the plan defined in the MapRedWork using
* the Hive runtime environment.
*/
@Override
public void execute(QueryDef qdef, WindowingShell wShell) throws WindowingException {
deleteQueryOutputDir(qdef);
MapredWork mr = PlanUtils.getMapRedWork();
try {
createOperatorTree(qdef, mr);
executePlan(mr, wShell.getCfg());
} catch (SemanticException se) {
throw new WindowingException(se);
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class MRExecutor method deleteQueryOutputDir.
static void deleteQueryOutputDir(QueryDef qDef) throws WindowingException {
try {
String outputPath = qDef.getOutput().getSpec().getPath();
FileSystem fs = FileSystem.get(URI.create(outputPath), qDef.getTranslationInfo().getHiveCfg());
Path p = new Path(outputPath);
if (fs.exists(p)) {
fs.delete(p, true);
}
} catch (IOException ie) {
throw new WindowingException(ie);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class Translator method translate.
public QueryDef translate(QuerySpec qSpec, WindowingShell wShell) throws WindowingException {
// clone the cfg
HiveConf qCfg = new HiveConf(wShell.getCfg());
QueryDef qry = new QueryDef();
qry.setSpec(qSpec);
QueryTranslationInfo transInfo = new QueryTranslationInfo();
transInfo.setHiveCfg(qCfg);
transInfo.setWshell(wShell);
try {
transInfo.setHive(Hive.get(qCfg));
transInfo.setHiveMSClient(HiveUtils.getClient(qCfg));
} catch (HiveException he) {
throw new WindowingException(he);
}
qry.setTranslationInfo(transInfo);
InputTranslation.translate(qry);
WhereTranslation.translate(qry);
OutputTranslation.translate(qry);
return qry;
}
Aggregations