public HashJoinIteration(EvaluationStrategy strategy, LeftJoin join, BindingSet bindings) throws QueryEvaluationException { this(strategy, join.getLeftArg(), join.getRightArg(), bindings, 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); } }
public FlattenedOptional(LeftJoin node) { rightArgs = getJoinArgs(node.getRightArg(), new HashSet<TupleExpr>()); boundVars = setWithOutConstants( Sets.intersection(node.getLeftArg().getAssuredBindingNames(), node.getRightArg().getBindingNames())); unboundVars = setWithOutConstants(Sets.difference(node.getRightArg().getBindingNames(), boundVars)); condition = node.getCondition(); rightArg = node.getRightArg(); getVarCounts(node); assuredBindingNames = new HashSet<>(leftArgVarCounts.keySet()); bindingNames = new HashSet<>(Sets.union(assuredBindingNames, unboundVars)); }
public Set<String> getBindingNames() { Set<String> bindingNames = new LinkedHashSet<String>(16); bindingNames.addAll(getLeftArg().getBindingNames()); bindingNames.addAll(getRightArg().getBindingNames()); return bindingNames; }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { binaryOpMeet(theJoin, theJoin.getLeftArg(), theJoin.getRightArg()); }
/** * @inheritDoc */ @Override public void meet(LeftJoin theJoin) throws Exception { theJoin.getLeftArg().visit(this); mJoinBuffer.append(" ["); theJoin.getRightArg().visit(this); if (theJoin.getCondition() != null) { mJoinBuffer.append(renderValueExpr(theJoin.getCondition())); } mJoinBuffer.setCharAt(mJoinBuffer.lastIndexOf(","), ' '); mJoinBuffer.append("], "); }
@Override public void meet(LeftJoin node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality *= leftArgCost; }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
@Override public void meet(LeftJoin node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality *= leftArgCost; }
@Override public void meet(LeftJoin node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality *= leftArgCost; }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
@Override public void meet(LeftJoin leftJoin) { leftJoin.getLeftArg().visit(this); Set<String> origBoundVars = boundVars; try { boundVars = new HashSet<String>(boundVars); boundVars.addAll(leftJoin.getLeftArg().getBindingNames()); leftJoin.getRightArg().visit(this); } finally { boundVars = origBoundVars; } }
@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 void meet(final LeftJoin node) { // Extract the metadata that will be stored for the node. final String leftJoinNodeId = nodeIds.getOrMakeId(node); final QueryModelNode left = node.getLeftArg(); final QueryModelNode right = node.getRightArg(); // Update the metadata for the JoinMetadata.Builder. makeJoinMetadata(leftJoinNodeId, JoinType.LEFT_OUTER_JOIN, left, right); // Walk to the next node. super.meet(node); }
private void addDistinctOwnersNonLocal(LeftJoin node, RepositoryConnection leftOwner, RepositoryConnection rightOwner) { if (leftOwner != null) { node.getLeftArg().replaceWith(new OwnedTupleExpr(leftOwner, node.getLeftArg().clone())); } if (rightOwner != null) { node.getRightArg().replaceWith(new OwnedTupleExpr(rightOwner, node.getRightArg().clone())); } }
@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 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 void meet(LeftJoin node) throws RepositoryException { super.meet(node); Var leftSubject = getLocalSubject(node.getLeftArg()); Var rightSubject = getLocalSubject(node.getRightArg()); // if local then left and right can be combined boolean local = leftSubject != null && leftSubject.equals(rightSubject); RepositoryConnection leftOwner = getSingleOwner(node.getLeftArg()); RepositoryConnection rightOwner = getSingleOwner(node.getRightArg()); addOwners(node, leftOwner, rightOwner, local); }
@Override public void meet(LeftJoin node) throws RepositoryException { super.meet(node); Var leftSubject = getLocalSubject(node.getLeftArg()); Var rightSubject = getLocalSubject(node.getRightArg()); // if local then left and right can be combined boolean local = leftSubject != null && leftSubject.equals(rightSubject); RepositoryConnection leftOwner = getSingleOwner(node.getLeftArg()); RepositoryConnection rightOwner = getSingleOwner(node.getRightArg()); addOwners(node, leftOwner, rightOwner, local); }
private void addToRightQueue(ValueExpr condition, BindingSet leftBindings) throws QueryEvaluationException, InterruptedException { CloseableIteration<BindingSet, QueryEvaluationException> result = strategy.evaluate(join.getRightArg(), leftBindings); if (condition != null) { result = new FilterCursor(result, condition, scopeBindingNames, strategy); } CloseableIteration<BindingSet, QueryEvaluationException> alt = new SingletonIteration<BindingSet, QueryEvaluationException>( leftBindings); rightQueue.put(new AlternativeCursor<BindingSet>(result, alt)); }