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

    https://github.com/apache/spark/pull/10734#discussion_r49556745
  
    --- 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 --
    
    how about `case class CaseWhen(whenList: Seq[Expression], thenList: 
Seq[Expression], else: Expression)` or `case class CaseWhen(whenList: 
Seq[Expression], thenListAndElse: Seq[Expression])`?


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