@Override public boolean equals(Object other) { if (other instanceof BinaryTupleOperator) { BinaryTupleOperator o = (BinaryTupleOperator)other; return leftArg.equals(o.getLeftArg()) && rightArg.equals(o.getRightArg()); } return false; }
@Override public boolean equals(Object other) { if (other instanceof BinaryTupleOperator) { BinaryTupleOperator o = (BinaryTupleOperator)other; return leftArg.equals(o.getLeftArg()) && rightArg.equals(o.getRightArg()); } return false; }
private TupleExpr joinOrExpr(BinaryTupleOperator theExpr) { if (theExpr.getLeftArg() != null && theExpr.getRightArg() == null) { return theExpr.getLeftArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() != null) { return theExpr.getRightArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() == null) { return null; } else { return theExpr; } }
private TupleExpr joinOrExpr(BinaryTupleOperator theExpr) { if (theExpr.getLeftArg() != null && theExpr.getRightArg() == null) { return theExpr.getLeftArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() != null) { return theExpr.getRightArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() == null) { return null; } else { return theExpr; } }
private TupleExpr joinOrExpr(BinaryTupleOperator theExpr) { if (theExpr.getLeftArg() != null && theExpr.getRightArg() == null) { return theExpr.getLeftArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() != null) { return theExpr.getRightArg(); } else if (theExpr.getLeftArg() == null && theExpr.getRightArg() == null) { return null; } else { return theExpr; } }
/** * Gets the {@link Side} the current node in the visitor is on relative to the provided node. * @param node - The node used to determine the side of the current visitor node. * @return The {@link Side} the current node is on. */ private Optional<Side> getSide(final QueryModelNode node) { // if query parent is a binary operator, need to determine if it's left or right. if (node.getParentNode() instanceof BinaryTupleOperator) { final BinaryTupleOperator binary = (BinaryTupleOperator) node.getParentNode(); if (node.equals(binary.getLeftArg())) { return Optional.of(Side.LEFT); } else { return Optional.of(Side.RIGHT); } } else { return Optional.empty(); } }
private void meetJoin(BinaryTupleOperator node) { node.getLeftArg().visit(this); updateMap(node.getLeftArg()); double leftArgCost = this.cardinality; Set<String> origBoundVars = boundVars; boundVars = new HashSet<>(boundVars); boundVars.addAll(node.getLeftArg().getBindingNames()); node.getRightArg().visit(this); updateMap(node.getRightArg()); cardinality *= leftArgCost * leftArgCost; boundVars = origBoundVars; updateMap(node); }
/** * Creates a join entry based on a provided {@link IterativeJoin} and the Join's * {@link BinaryTupleOperator}. * * @param id - The ID of the join. * @param joinFunction - The {@link IterativeJoin} function to perform during processing. * @param node - The {@link BinaryTupleOperator} used to create the process. */ private void meetJoin(final String id, final IterativeJoin joinFunction, final BinaryTupleOperator node) { final Set<String> leftArgs = node.getLeftArg().getBindingNames(); final Set<String> rightArgs = node.getRightArg().getBindingNames(); final List<String> joinVars = Lists.newArrayList(Sets.intersection(leftArgs, rightArgs)); leftArgs.removeAll(joinVars); rightArgs.removeAll(joinVars); final List<String> otherVars = new ArrayList<>(); otherVars.addAll(leftArgs); otherVars.addAll(rightArgs); // the join variables need to be sorted so that when compared to all // the variables, the start of the all variable list is congruent to // the join var list. joinVars.sort(Comparator.naturalOrder()); otherVars.sort(Comparator.naturalOrder()); final List<String> allVars = new ArrayList<>(); allVars.addAll(joinVars); allVars.addAll(otherVars); final Optional<Side> side = getSide(node); final JoinProcessorSupplier supplier = new JoinProcessorSupplier(id, joinFunction, joinVars, allVars, result -> getResult(side, result)); entries.add(new ProcessorEntry(node, id, side, supplier, Lists.newArrayList(node.getLeftArg(), node.getRightArg()))); idMap.put(node, id); }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality += leftArgCost; }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { node.getLeftArg().visit(this); double leftArgCost = this.cardinality; node.getRightArg().visit(this); cardinality += leftArgCost; }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { node.getLeftArg().visit(this); updateMap(node.getLeftArg()); double leftArgCost = this.cardinality; node.getRightArg().visit(this); updateMap(node.getRightArg()); cardinality += leftArgCost; updateMap(node); }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { if (node.getLeftArg() == former) { if (replacement == null) { replaceNode(node, node.getRightArg()); } else { node.setLeftArg((TupleExpr)replacement); } } else { assert former == node.getRightArg(); if (replacement == null) { replaceNode(node, node.getLeftArg()); } else { node.setRightArg((TupleExpr)replacement); } } }
@Override protected void meetBinaryTupleOperator(BinaryTupleOperator node) { if (node.getLeftArg() == former) { if (replacement == null) { replaceNode(node, node.getRightArg()); } else { node.setLeftArg((TupleExpr)replacement); } } else { assert former == node.getRightArg(); if (replacement == null) { replaceNode(node, node.getLeftArg()); } else { node.setRightArg((TupleExpr)replacement); } } }
@Override public BinaryTupleOperator clone() { BinaryTupleOperator clone = (BinaryTupleOperator)super.clone(); clone.setLeftArg(getLeftArg().clone()); clone.setRightArg(getRightArg().clone()); return clone; } }
@Override public BinaryTupleOperator clone() { BinaryTupleOperator clone = (BinaryTupleOperator)super.clone(); clone.setLeftArg(getLeftArg().clone()); clone.setRightArg(getRightArg().clone()); return clone; } }
if (aJoin.getLeftArg() == null) { aJoin.setLeftArg(aExpr);
if (aJoin.getLeftArg() == null) { aJoin.setLeftArg(aExpr);
if (aJoin.getLeftArg() == null) { aJoin.setLeftArg(aExpr);