public HashJoinIteration(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings) throws QueryEvaluationException { this(strategy, join.getLeftArg(), join.getRightArg(), bindings, true); }
super.meet(leftJoin); TupleExpr leftArg = leftJoin.getLeftArg(); TupleExpr rightArg = leftJoin.getRightArg(); ValueExpr condition = leftJoin.getCondition(); leftJoin.replaceWith(leftArg); leftJoin.replaceWith(leftArg); leftJoin.replaceWith(leftArg); leftJoin.replaceWith(leftArg); leftJoin.setCondition(null);
@Override public void meet(LeftJoin node) throws RuntimeException { node.getLeftArg().visit(this); parts.addLast(new SQLFragment()); if(node.hasCondition()) { parts.getLast().getFilters().add(node.getCondition()); } node.getRightArg().visit(this); }
@Override public boolean equals(Object other) { if (other instanceof LeftJoin && super.equals(other)) { ValueExpr oCond = ((LeftJoin)other).getCondition(); return nullEquals(condition, oCond); } return false; }
public ParallelLeftJoinCursor(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings) throws QueryEvaluationException { super(); this.strategy = strategy; this.join = join; this.scopeBindingNames = join.getBindingNames(); this.leftIter = strategy.evaluate(join.getLeftArg(), bindings); }
@Override public void meet(final LeftJoin n) { final TupleExpr l = n.getLeftArg(); final TupleExpr r = n.getCondition() == null ? n.getRightArg() : // new Filter(n.getRightArg(), n.getCondition()); emit(l); if (!(l instanceof SingletonSet)) { newline(); } emit("OPTIONAL ").emit(r, true); }
@Override public String toString() { String left = leftIter.toString().replace("\n", LF_TAB); String right = (null == rightIter) ? join.getRightArg().toString() : rightIter.toString(); ValueExpr condition = join.getCondition(); String filter = (null == condition) ? "" : condition.toString().trim().replace("\n", LF_TAB); return "ParallelLeftJoin " + filter + LF_TAB + left + LF_TAB + right.replace("\n", LF_TAB); } }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { ctxOpen(theJoin); // try and reverse engineer the original scoping intent of the query final boolean aNeedsNewScope = theJoin.getParentNode() != null && (theJoin.getParentNode() instanceof Join || theJoin.getParentNode() instanceof LeftJoin); if (aNeedsNewScope) { mJoinBuffer.append("{\n"); } theJoin.getLeftArg().visit(this); mJoinBuffer.append(indent()).append("OPTIONAL {\n"); mIndent += 2; theJoin.getRightArg().visit(this); if (theJoin.getCondition() != null) { mJoinBuffer.append(indent()).append("filter").append(renderValueExpr(theJoin.getCondition())).append( "\n"); } mIndent -= 2; mJoinBuffer.append(indent()).append("}.\n"); if (aNeedsNewScope) { mJoinBuffer.append("}.\n"); } ctxClose(theJoin); }
@Override public void meet(LeftJoin node) { super.meet(node); if (node.getCondition() != null) { List<ValueExpr> conjunctiveConstraints = new ArrayList<ValueExpr>(16); getConjunctiveConstraints(node.getCondition(), conjunctiveConstraints); TupleExpr arg = node.getRightArg(); ValueExpr condition = null; for (ValueExpr constraint : conjunctiveConstraints) { if (isWithinBindingScope(constraint, arg)) { arg = new Filter(arg, constraint); } else if (condition == null) { condition = constraint; } else { condition = new And(condition, constraint); } } node.setCondition(condition); node.setRightArg(arg); } }
TupleExpr union = null; for (RepositoryConnection member : members) { OwnedTupleExpr arg = new OwnedTupleExpr(member, node.clone()); union = union == null ? arg : new Union(union, arg); node.replaceWith(union); node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone())); node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone())); for (RepositoryConnection member : members) { if (rightOwner == member) { OwnedTupleExpr arg = new OwnedTupleExpr(member, node.clone()); union = union == null ? arg : new Union(union, arg); OwnedTupleExpr arg = new OwnedTupleExpr(member, node.getLeftArg().clone()); union = union == null ? arg : new Union(union, arg); node.replaceWith(union); node.replaceWith(new OwnedTupleExpr(leftOwner, node.getLeftArg().clone())); node.getLeftArg().replaceWith(new OwnedTupleExpr(leftOwner, node.getLeftArg().clone())); node.getRightArg().replaceWith(new OwnedTupleExpr(rightOwner, node.getRightArg().clone()));
@Override public void meet(final LeftJoin leftJoin) { if (leftJoin.getLeftArg().getBindingNames().containsAll(filterVars)) { leftJoin.getLeftArg().visit(this); } else { relocate(filter, leftJoin.getLeftArg()); } }
@Override public LeftJoin clone() { LeftJoin clone = (LeftJoin)super.clone(); if (hasCondition()) { clone.setCondition(getCondition().clone()); } return clone; } }
private static TupleExpr getJoin(TupleExpr oldJoin, TupleExpr newArg) { if (newArg instanceof FlattenedOptional) { return new LeftJoin(oldJoin, ((FlattenedOptional) newArg).getRightArg()); } else { return new Join(oldJoin, newArg); } }
private void addDistinctOwnersLocal(LeftJoin node, RepositoryConnection leftOwner, RepositoryConnection rightOwner) { if (rightOwner == null) { node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone())); } else if (leftOwner == null) { TupleExpr union = null; for (RepositoryConnection member : members) { if (rightOwner == member) { OwnedTupleExpr arg = new OwnedTupleExpr(member, // NOPMD node.clone()); union = union == null ? arg : new Union(union, arg); // NOPMD } else { OwnedTupleExpr arg = new OwnedTupleExpr(member, // NOPMD node.getLeftArg().clone()); union = union == null ? arg : new Union(union, arg); // NOPMD } } node.replaceWith(union); } else { node.replaceWith(new OwnedTupleExpr(leftOwner, node.getLeftArg().clone())); } }
LeftJoin lj = new LeftJoin(); lj.setLeftArg(aLeft); lj.setRightArg(aExpr);
@Override public int hashCode() { int result = super.hashCode() ^ "LeftJoin".hashCode(); if (hasCondition()) { result ^= getCondition().hashCode(); } return result; }
join.setLeftArg(leftJoin.getLeftArg()); leftJoin.setLeftArg(join); leftJoin.visit(this); join.setRightArg(leftJoin.getLeftArg()); leftJoin.setLeftArg(join); leftJoin.visit(this);
Join join = new Join(bindings, binary.getLeftArg()); binary.setLeftArg(join);
BinaryTupleOperator aJoin = aGroup.isOptional() ? new LeftJoin() : new Join(); ((LeftJoin)aJoin).setCondition(aBasicGroup.filtersAsAnd());
@Override public void meet(LeftJoin node) { handleType(SeRQO.LEFTJOIN); handleChild(SeRQO.CONDITION, node.getCondition()); super.meet(node); }