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)
{