while(true) {
res = processPlan();
if(res.returnStatus==POStatus.STATUS_OK) {
if(lineageTracer != null && res.result != null) {
ExampleTuple tOut = new ExampleTuple((Tuple) res.result);
tOut.synthetic = tIn.synthetic;
lineageTracer.insert(tOut);
lineageTracer.union(tOut, tIn);
res.result = tOut;
}
return res;
}
if(res.returnStatus==POStatus.STATUS_EOP) {
processingPlan = false;
break;
}
if(res.returnStatus==POStatus.STATUS_ERR) {
return res;
}
if(res.returnStatus==POStatus.STATUS_NULL) {
continue;
}
}
}
//The nested plan processing is done or is
//yet to begin. So process the input and start
//nested plan processing on the input tuple
//read
while (true) {
inp = processInput();
if (inp.returnStatus == POStatus.STATUS_EOP ||
inp.returnStatus == POStatus.STATUS_ERR) {
return inp;
}
if (inp.returnStatus == POStatus.STATUS_NULL) {
continue;
}
attachInputToPlans((Tuple) inp.result);
Tuple tuple = (Tuple)inp.result;
for (PhysicalOperator po : opsToBeReset) {
po.reset();
}
if (isAccumulative()) {
for(int i=0; i<tuple.size(); i++) {
if (tuple.getType(i) == DataType.BAG) {
// we only need to check one bag, because all the bags
// share the same buffer
buffer = ((AccumulativeBag)tuple.get(i)).getTuplebuffer();
break;
}
}
while(true) {
if (buffer.hasNextBatch()) {
try {
buffer.nextBatch();
}catch(IOException e) {
throw new ExecException(e);
}
setAccumStart();
}else{
buffer.clear();
setAccumEnd();
}
res = processPlan();
if (res.returnStatus == POStatus.STATUS_BATCH_OK) {
// attach same input again to process next batch
attachInputToPlans((Tuple) inp.result);
} else {
break;
}
}
} else {
res = processPlan();
}
processingPlan = true;
if(lineageTracer != null && res.result != null) {
//we check for res.result since that can also be null in the case of flatten
tIn = (ExampleTuple) inp.result;
ExampleTuple tOut = new ExampleTuple((Tuple) res.result);
tOut.synthetic = tIn.synthetic;
lineageTracer.insert(tOut);
lineageTracer.union(tOut, tIn);
res.result = tOut;
}