Search in sources :

Example 1 with JoinExecutionPlan

use of org.apache.jackrabbit.oak.query.plan.JoinExecutionPlan in project jackrabbit-oak by apache.

the class JoinImpl method prepare.

@Override
public void prepare(ExecutionPlan p) {
    if (!(p instanceof JoinExecutionPlan)) {
        throw new IllegalArgumentException("Not a join plan");
    }
    JoinExecutionPlan joinPlan = (JoinExecutionPlan) p;
    if (joinPlan.getJoin() != this) {
        throw new IllegalArgumentException("Not a plan for this join");
    }
    this.plan = joinPlan;
    applyJoinConditions();
    left.prepare(joinPlan.getLeftPlan());
    right.prepare(joinPlan.getRightPlan());
}
Also used : JoinExecutionPlan(org.apache.jackrabbit.oak.query.plan.JoinExecutionPlan)

Example 2 with JoinExecutionPlan

use of org.apache.jackrabbit.oak.query.plan.JoinExecutionPlan in project jackrabbit-oak by apache.

the class JoinImpl method prepare.

@Override
public ExecutionPlan prepare() {
    if (plan != null) {
        return plan;
    }
    applyJoinConditions();
    // the estimated cost is the cost of the left selector,
    // plus twice the cost of the right selector (we expect
    // two rows for the right selector for each node 
    // on the left selector)
    ExecutionPlan leftPlan = left.prepare();
    ExecutionPlan rightPlan = right.prepare();
    double cost = leftPlan.getEstimatedCost() + 2 * rightPlan.getEstimatedCost();
    plan = new JoinExecutionPlan(this, leftPlan, rightPlan, cost);
    return plan;
}
Also used : JoinExecutionPlan(org.apache.jackrabbit.oak.query.plan.JoinExecutionPlan) JoinExecutionPlan(org.apache.jackrabbit.oak.query.plan.JoinExecutionPlan) ExecutionPlan(org.apache.jackrabbit.oak.query.plan.ExecutionPlan)

Aggregations

JoinExecutionPlan (org.apache.jackrabbit.oak.query.plan.JoinExecutionPlan)2 ExecutionPlan (org.apache.jackrabbit.oak.query.plan.ExecutionPlan)1