Returns true if expr
can be evaluated using only the output of plan
.
Returns true if expr
can be evaluated using only the output of plan
. This method
can be used to determine when it is acceptable to move expression evaluation within a query
plan.
For example consider a join between two relations R(a, b) and S(c, d).
- canEvaluate(EqualTo(a,b), R)
returns true
- canEvaluate(EqualTo(a,c), R)
returns false
- canEvaluate(Literal(1), R)
returns true
as literals CAN be evaluated on any plan
Returns true iff expr
could be evaluated as a condition within join.
Returns true iff expr
could be evaluated as a condition within join.
Returns true when an expression contains correlated predicates i.e outer references and returns false otherwise.
Returns the correlated predicates from a logical plan.
Returns the correlated predicates from a logical plan. The OuterReference wrapper is removed before returning the predicate to the caller.
Returns all the expressions that have outer references from a logical plan.
Returns all the expressions that have outer references from a logical plan. Currently only Filter operator can host outer references.
Given a list of expressions, returns the expressions which have outer references.
Given a list of expressions, returns the expressions which have outer references. Aggregate expressions are treated in a special way. If the children of aggregate expression contains an outer reference, then the entire aggregate expression is marked as an outer reference. Example (SQL):
SELECT a FROM l GROUP by 1 HAVING EXISTS (SELECT 1 FROM r WHERE d < min(b))
In the above case, we want to mark the entire min(b) as an outer reference OuterReference(min(b)) instead of min(OuterReference(b)). TODO: Currently we don't allow deep correlation. Also, we don't allow mixing of outer references and local references under an aggregate expression. For example (SQL):
SELECT .. FROM p1
WHERE EXISTS (SELECT ...
FROM p2
WHERE EXISTS (SELECT ...
FROM sq
WHERE min(p1.a + p2.b) = sq.c))
SELECT .. FROM p1
WHERE EXISTS (SELECT ...
FROM p2
WHERE EXISTS (SELECT ...
FROM sq
WHERE min(p1.a) + max(p2.b) = sq.c))
SELECT .. FROM p1
WHERE EXISTS (SELECT ...
FROM p2
WHERE EXISTS (SELECT ...
FROM sq
WHERE min(p1.a + sq.c) > 1))
The code below needs to change when we support the above cases.
Returns whether there are any null-aware predicate subqueries inside Not.
Returns whether there are any null-aware predicate subqueries inside Not. If not, we could turn the null-aware predicate into not-null-aware predicate.
Given a logical plan, returns TRUE if it has an outer reference and false otherwise.
Returns an expression after removing the OuterReference shell.
Returns the logical plan after removing the OuterReference shell from all the expressions of the input logical plan.
Returns the list of expressions after removing the OuterReference shell from each of the expression.