Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15103#discussion_r79477760
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala 
---
    @@ -109,7 +109,9 @@ object EliminateOuterJoin extends Rule[LogicalPlan] 
with PredicateHelper {
         if (!e.deterministic || SubqueryExpression.hasCorrelatedSubquery(e)) 
return false
         val attributes = e.references.toSeq
         val emptyRow = new GenericInternalRow(attributes.length)
    -    val v = BindReferences.bindReference(e, attributes).eval(emptyRow)
    +    val boundE = BindReferences.bindReference(e, attributes)
    +    if (boundE.find(_.isInstanceOf[Unevaluable]).isDefined) return false
    --- End diff --
    
    It looks like there's a similar `hasUnevaluableExpression` check [in the 
`ConvertToLocalRelation` optimizer 
rule](https://github.com/apache/spark/blame/d403562eb4b5b1d804909861d3e8b75d8f6323b9/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala#L1036),
 except that rule also carves out a special-case exception for 
`AttributeReference` (see https://github.com/apache/spark/pull/13418#r65273025 
for discussion). 
    
    I guess we don't want to do that exemption here, though, since we're 
actually having to evaluate the rule and the attribute reference won't be 
replaced before evaluation.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to