// Does the left and right operand have any initial plans?
if (currentLeft + currentRight != max || currentLeft == 0 || currentRight == 0){
return;
}
// find the best plans for the left and right operands of the currently considered join by looking into the table for dynamic programming
final Plan left = bestPlans[currentLeft - 1].get(keyLeft);
final Plan right = bestPlans[currentRight - 1].get(keyRight);
final Plan combined = new InnerNodePlan(left.clone(), right.clone());
this.lockBestPlan.lock();
try {
// do we have new best plan for joining the initial plans of the left and right operand?
final Plan currentBest = bestPlans[max - 1].get(keyLeft + keyRight);
if (currentBest == null || currentBest.compareTo(combined) > 0){
bestPlans[max - 1].put(keyLeft + keyRight, combined);
}
return;
} finally {
this.lockBestPlan.unlock();