public JoinImpl join(SourceImpl left, SourceImpl right, JoinType joinType, JoinConditionImpl joinCondition) { return new JoinImpl(left, right, joinType, joinCondition); }
/** * Calls accept on the two sources and the join condition in the join node. */ @Override public boolean visit(JoinImpl node) { node.getLeft().accept(this); node.getRight().accept(this); node.getJoinCondition().accept(this); return true; }
@Override public String getIndexCostInfo(NodeState rootState) { StringBuilder buff = new StringBuilder(); buff.append(toString()); buff.append("{ "); buff.append(left.getIndexCostInfo(rootState)); buff.append(", "); buff.append(right.getIndexCostInfo(rootState)); buff.append(" }"); return buff.toString(); }
@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()); }
@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()); }
/** * Calls accept on the two sources and the join condition in the join node. */ @Override public boolean visit(JoinImpl node) { node.getLeft().accept(this); node.getRight().accept(this); node.getJoinCondition().accept(this); return true; }
public JoinImpl join(SourceImpl left, SourceImpl right, JoinType joinType, JoinConditionImpl joinCondition) { return new JoinImpl(left, right, joinType, joinCondition); }
@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()); }
@Override public String getIndexCostInfo(NodeState rootState) { StringBuilder buff = new StringBuilder(); buff.append(toString()); buff.append("{ "); buff.append(left.getIndexCostInfo(rootState)); buff.append(", "); buff.append(right.getIndexCostInfo(rootState)); buff.append(" }"); return buff.toString(); }
/** * Calls accept on the two sources and the join condition in the join node. */ @Override public boolean visit(JoinImpl node) { node.getLeft().accept(this); node.getRight().accept(this); node.getJoinCondition().accept(this); return true; }
public JoinImpl join(SourceImpl left, SourceImpl right, JoinType joinType, JoinConditionImpl joinCondition) { return new JoinImpl(left, right, joinType, joinCondition); }
@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; }
@Override public String getIndexCostInfo(NodeState rootState) { StringBuilder buff = new StringBuilder(); buff.append(toString()); buff.append("{ "); buff.append(left.getIndexCostInfo(rootState)); buff.append(", "); buff.append(right.getIndexCostInfo(rootState)); buff.append(" }"); return buff.toString(); }
private static SourceImpl buildJoin(SourceImpl result, SourceImpl last, List<JoinConditionImpl> conditions) { if (result == null) { return last; } List<SourceImpl> selectors = result.getInnerJoinSelectors(); Set<SourceImpl> oldSelectors = new HashSet<SourceImpl>(); oldSelectors.addAll(selectors); Set<SourceImpl> newSelectors = new HashSet<SourceImpl>(); newSelectors.addAll(selectors); newSelectors.add(last); for (JoinConditionImpl j : conditions) { // only join conditions can now be evaluated, // but couldn't be evaluated before if (!j.canEvaluate(oldSelectors) && j.canEvaluate(newSelectors)) { JoinImpl join = new JoinImpl(result, last, JoinType.INNER, j); return join; } } // no join condition was found return null; }
@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; }
private static SourceImpl buildJoin(SourceImpl result, SourceImpl last, List<JoinConditionImpl> conditions) { if (result == null) { return last; } List<SourceImpl> selectors = result.getInnerJoinSelectors(); Set<SourceImpl> oldSelectors = new HashSet<SourceImpl>(); oldSelectors.addAll(selectors); Set<SourceImpl> newSelectors = new HashSet<SourceImpl>(); newSelectors.addAll(selectors); newSelectors.add(last); for (JoinConditionImpl j : conditions) { // only join conditions can now be evaluated, // but couldn't be evaluated before if (!j.canEvaluate(oldSelectors) && j.canEvaluate(newSelectors)) { JoinImpl join = new JoinImpl(result, last, JoinType.INNER, j); return join; } } // no join condition was found return null; }
@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; }
private static SourceImpl buildJoin(SourceImpl result, SourceImpl last, List<JoinConditionImpl> conditions) { if (result == null) { return last; } List<SourceImpl> selectors = result.getInnerJoinSelectors(); Set<SourceImpl> oldSelectors = new HashSet<SourceImpl>(); oldSelectors.addAll(selectors); Set<SourceImpl> newSelectors = new HashSet<SourceImpl>(); newSelectors.addAll(selectors); newSelectors.add(last); for (JoinConditionImpl j : conditions) { // only join conditions can now be evaluated, // but couldn't be evaluated before if (!j.canEvaluate(oldSelectors) && j.canEvaluate(newSelectors)) { JoinImpl join = new JoinImpl(result, last, JoinType.INNER, j); return join; } } // no join condition was found return null; }
@Override public AstElement copyOf() { return new JoinImpl( (SourceImpl) copyElementAndCheckReference(left), (SourceImpl) copyElementAndCheckReference(right), joinType, (JoinConditionImpl) copyElementAndCheckReference(joinCondition) ); } }
@Override public AstElement copyOf() { return new JoinImpl( (SourceImpl) copyElementAndCheckReference(left), (SourceImpl) copyElementAndCheckReference(right), joinType, (JoinConditionImpl) copyElementAndCheckReference(joinCondition) ); } }