/** * Verifies if the supplied {@link TupleExpr} contains a {@link Projection} with the subquery flag set to * true (default). If the supplied TupleExpr is a {@link Join} or contains a {@link Join}, projections * inside that Join's arguments will not be taken into account. * * @param t * a tuple expression. * @return <code>true</code> if the TupleExpr contains a subquery projection (outside of a Join), * <code>false</code> otherwise. */ public static boolean containsSubquery(TupleExpr t) { Deque<TupleExpr> queue = new ArrayDeque<>(); queue.add(t); while (!queue.isEmpty()) { TupleExpr n = queue.removeFirst(); if (n instanceof Projection && ((Projection)n).isSubquery()) { return true; } else if (n instanceof Join) { // projections already inside a Join need not be // taken into account return false; } else { queue.addAll(getChildren(n)); } } return false; }
/** * Verifies if the supplied {@link TupleExpr} contains a {@link Projection} with the subquery flag set to * true (default). If the supplied TupleExpr is a {@link Join} or contains a {@link Join}, projections * inside that Join's arguments will not be taken into account. * * @param t * a tuple expression. * @return <code>true</code> if the TupleExpr contains a subquery projection (outside of a Join), * <code>false</code> otherwise. */ public static boolean containsSubquery(TupleExpr t) { Deque<TupleExpr> queue = new ArrayDeque<>(); queue.add(t); while (!queue.isEmpty()) { TupleExpr n = queue.removeFirst(); if (n instanceof Projection && ((Projection)n).isSubquery()) { return true; } else if (n instanceof Join) { // projections already inside a Join need not be // taken into account return false; } else { queue.addAll(getChildren(n)); } } return false; }
if (projection.isSubquery()) { pushDownBindings = new QueryBindingSet(); for (ProjectionElem pe : projection.getProjectionElemList().getElements()) {