Random r = new Random();
// get the list of original inputs
// List<PhysicalOperator> inputs = physOp.getInputs();
List<PhysicalOperator> inputs = new ArrayList<PhysicalOperator>();
PhysicalPlan phy = new PhysicalPlan();
phy.add(physOp);
// for(PhysicalOperator input : physOp.getInputs()) {
for (PhysicalOperator input : physPlan.getPredecessors(physOp)) {
inputs.add(input.getInputs().get(0));
// input.setInputs(null);
phy.add(input);
try {
phy.connect(input, physOp);
} catch (PlanException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error("Error connecting " + input.name() + " to "
+ physOp.name());
}
}
physOp.setLineageTracer(lineage);
// replace the original inputs by POReads
for (int i = 0; i < inputs.size(); i++) {
DataBag bag = derivedData.get(cg.getInputs().get(i));
PORead por = new PORead(new OperatorKey("", r.nextLong()), bag);
phy.add(por);
try {
phy.connect(por, physOp.getInputs().get(i));
} catch (PlanException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error("Error connecting " + por.name() + " to "
+ physOp.name());