Github user sameeragarwal commented on a diff in the pull request:
https://github.com/apache/spark/pull/14815#discussion_r76351420
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -1386,15 +1386,17 @@ object EliminateOuterJoin extends Rule[LogicalPlan]
with PredicateHelper {
object PushPredicateThroughJoin extends Rule[LogicalPlan] with
PredicateHelper {
/**
* Splits join condition expressions into three categories based on the
attributes required
- * to evaluate them.
+ * to evaluate them. Note that we explicitly exclude non-deterministic
(i.e., stateful) condition
+ * expressions in canEvaluateInLeft or canEvaluateInRight to prevent
pushing these predicates on
+ * either side of the join.
*
* @return (canEvaluateInLeft, canEvaluateInRight, haveToEvaluateInBoth)
*/
private def split(condition: Seq[Expression], left: LogicalPlan, right:
LogicalPlan) = {
val (leftEvaluateCondition, rest) =
- condition.partition(_.references subsetOf left.outputSet)
+ condition.partition(expr =>
expr.references.subsetOf(left.outputSet) && expr.deterministic)
--- End diff --
Good catch! Didn't realize that relative ordering of these expressions
could become an issue.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]