static ArrayList<Object> executeFnwithWindow(QueryDef qDef, WindowFunctionDef wFnDef, Partition iPart)
throws HiveException, WindowingException
{
ArrayList<Object> vals = new ArrayList<Object>();
GenericUDAFEvaluator fEval = wFnDef.getEvaluator();
Object[] args = new Object[wFnDef.getArgs().size()];
for(int i=0; i < iPart.size(); i++)
{
AggregationBuffer aggBuffer = fEval.getNewAggregationBuffer();
Range rng = getRange(wFnDef, i, iPart);
PartitionIterator<Object> rItr = rng.iterator();
RuntimeUtils.connectLeadLagFunctionsToPartition(qDef, rItr);
while(rItr.hasNext())
{
Object row = rItr.next();
int j = 0;
for(ArgDef arg : wFnDef.getArgs())
{
args[j++] = arg.getExprEvaluator().evaluate(row);
}
fEval.aggregate(aggBuffer, args);
}
Object out = fEval.evaluate(aggBuffer);
out = ObjectInspectorUtils.copyToStandardObject(out, wFnDef.getOI(), ObjectInspectorCopyOption.WRITABLE);
vals.add(out);
}
return vals;
}