Skip to content

Commit a9c97ce

Browse files
committed
Address feedback
1 parent 18e2d8d commit a9c97ce

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,8 @@ object SimplifyConditionals extends Rule[LogicalPlan] with PredicateHelper {
415415
val (h, t) = branches.span(_._1 != TrueLiteral)
416416
CaseWhen( h :+ t.head, None)
417417

418-
case CaseWhen(branches, elseValue) if branches.length == 1 =>
419-
val cond = branches.head._1
420-
val trueValue = branches.head._2
421-
val falseValue = elseValue.getOrElse(Literal(null, trueValue.dataType))
422-
If(cond, trueValue, falseValue)
418+
case CaseWhen((cond, branchValue) :: Nil, elseValue) =>
419+
If(cond, branchValue, elseValue.getOrElse(Literal(null, branchValue.dataType)))
423420
}
424421
}
425422
}

0 commit comments

Comments
 (0)