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

    https://github.com/apache/spark/pull/10734#discussion_r49556863
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala
 ---
    @@ -81,44 +81,39 @@ case class If(predicate: Expression, trueValue: 
Expression, falseValue: Expressi
     /**
      * Case statements of the form "CASE WHEN a THEN b [WHEN c THEN d]* [ELSE 
e] END".
      * When a = true, returns b; when c = true, returns d; else returns e.
    + *
    + * @param branches seq of (branch condition, branch value)
    + * @param elseValue optional value for the else branch
      */
    -case class CaseWhen(branches: Seq[Expression]) extends Expression {
    -
    -  // Use private[this] Array to speed up evaluation.
    -  @transient private[this] lazy val branchesArr = branches.toArray
    -
    -  override def children: Seq[Expression] = branches
    -
    -  @transient lazy val whenList =
    -    branches.sliding(2, 2).collect { case Seq(whenExpr, _) => whenExpr 
}.toSeq
    -
    -  @transient lazy val thenList =
    -    branches.sliding(2, 2).collect { case Seq(_, thenExpr) => thenExpr 
}.toSeq
    +case class CaseWhen(branches: Seq[(Expression, Expression)], elseValue: 
Option[Expression] = None)
    --- End diff --
    
    That was the original version - and I changed to this one after discussing 
with @marmbrus because it is more explicit and the dimension of "whenList" and 
"thenList" are guaranteed to be the same by the type signature.


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