Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9120#discussion_r42049885
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ---
    @@ -171,17 +172,24 @@ object ExtractEquiJoinKeys extends Logging with 
PredicateHelper {
           logDebug(s"Considering join on: $condition")
           // Find equi-join predicates that can be evaluated before the join, 
and thus can be used
           // as join keys.
    -      val (joinPredicates, otherPredicates) =
    -        condition.map(splitConjunctivePredicates).getOrElse(Nil).partition 
{
    -          case EqualTo(l, r) =>
    -            (canEvaluate(l, left) && canEvaluate(r, right)) ||
    -            (canEvaluate(l, right) && canEvaluate(r, left))
    -          case _ => false
    -        }
    -
    -      val joinKeys = joinPredicates.map {
    +      val predicates = 
condition.map(splitConjunctivePredicates).getOrElse(Nil)
    +      val joinKeys = predicates.map {
             case EqualTo(l, r) if canEvaluate(l, left) && canEvaluate(r, 
right) => (l, r)
             case EqualTo(l, r) if canEvaluate(l, right) && canEvaluate(r, 
left) => (r, l)
    +        case EqualNullSafe(l @ AtomicType(), r @ AtomicType())
    +          if canEvaluate(l, left) && canEvaluate(r, right) =>
    +          (Coalesce(Seq(l, Literal.default(l.dataType))),
    +            Coalesce(Seq(r, Literal.default(r.dataType))))
    +        case EqualNullSafe(l @ AtomicType(), r @ AtomicType())
    --- End diff --
    
    Why AtomicType? Looks we only forbid binary type and map type in join 
condition: 
https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L91-L104


---
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]

Reply via email to