25.01.2015 Views

Cost-Based Optimization of Integration Flows - Datenbanken ...

Cost-Based Optimization of Integration Flows - Datenbanken ...

Cost-Based Optimization of Integration Flows - Datenbanken ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6 On-Demand Re-<strong>Optimization</strong><br />

o 3 o 4<br />

o 2 o 3<br />

(a) Partial POT 1<br />

|ds in1| |ds out1| |ds in1| |ds out1| |ds in1| |ds out1| |ds in1| |ds out1|<br />

sel(o2)<br />

sel(o3)<br />

sel(o3)<br />

sel(o4)<br />

≤<br />

≤<br />

o 2 o 3<br />

|ds in1| |ds out1| |ds in1| |ds out1|<br />

sel(o2)<br />

sel(o3)<br />

≤<br />

≤<br />

(b) Partial POT 2 (c) Merged POT<br />

Figure 6.6: Merging Partial PlanOptTrees<br />

o 4<br />

|ds in1| |ds out1|<br />

sel(o4)<br />

invoke this algorithm (line 4), where all subcalls can access the existing PlanOptTree<br />

root. Otherwise, we apply all optimization techniques and obtain the resulting partial<br />

PlanOptTree for the atomic operator (line 6). If no PlanOptTree exists so far, the first<br />

partial PlanOptTree is used as root; otherwise, we merge the partial PlanOptTree with the<br />

existing root (lines 7-22). When merging, we first clear the MEMO structure (line 11). Then,<br />

we check for the existence <strong>of</strong> operators as well as statistic nodes, and we add the new nodes<br />

if required. At the level <strong>of</strong> complex statistic nodes, we invoke the modifyDanglingRefs<br />

in order to change the references <strong>of</strong> complex statistics and optimality conditions to the<br />

existing PlanOptTree. We use the MEMO structure in order to mark already processed<br />

paths <strong>of</strong> the new partial PlanOptTree. As a result, we guarantee a worst-case number<br />

Algorithm 6.1 Initial PlanOptTree Creation (A-IPC)<br />

Require: operator op, global variable root (initially set to NULL)<br />

1: o ← op.getSequenceOfOperators()<br />

2: for i ← 1 to |o| do // for each operator o i<br />

3: if type(o i ) ∈ (Plan, Switch, Fork, Iteration, Undefined) then // complex<br />

4: o i ← A-IPC(o i )<br />

5: else // atomic<br />

6: ppot ← getPartialOptTree(o i )<br />

7: if root = NULL then<br />

8: root ← ppot<br />

9: else<br />

10: // merge partial PlanOptTrees<br />

11: clear memo<br />

12: for all on ∈ ppot.onodes do // for each ONode on<br />

13: if root.containsONode(on.nid) then<br />

14: eon ← root.getOperator(on.nid)<br />

15: for all sn ∈ on.snodes do // for each SNode sn<br />

16: if eon.containsSNode(sn.type) then<br />

17: eson ← eon.getSNode(sn.type)<br />

18: modifyDanglingRefs(eon, eson, on, sn)<br />

19: else<br />

20: eon.snodes.add(sn)<br />

21: else<br />

22: root.onodes.add(on) // add operator subtree<br />

23: return root<br />

174

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!