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

    https://github.com/apache/spark/pull/21850#discussion_r205187664
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
 ---
    @@ -414,6 +414,16 @@ object SimplifyConditionals extends Rule[LogicalPlan] 
with PredicateHelper {
             // these branches can be pruned away
             val (h, t) = branches.span(_._1 != TrueLiteral)
             CaseWhen( h :+ t.head, None)
    +
    +      case CaseWhen(branches, elseValue) if branches.length == 1 =>
    +        // Using pattern matching like `CaseWhen((cond, branchValue) :: 
Nil, elseValue)` will not
    +        // work since the implementation of `branches` can be 
`ArrayBuffer`. A full test is in
    --- End diff --
    
    @ueshin thanks! The code is much more cleaner.


---

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

Reply via email to