Skip to content

Commit

Permalink
code improve
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-wang committed Sep 3, 2014
1 parent eed35fc commit d7315b3
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,7 @@ case class CaseWhen(branches: Seq[Expression]) extends Expression {
false
} else {
val allCondBooleans = predicates.forall(_.dataType == BooleanType)
val valueTypes = branches.sliding(2, 2).map {
case Seq(_, value) => value.dataType
case Seq(elseVal) => elseVal.dataType
}.toSeq
val dataTypesEqual = valueTypes.distinct.size <= 1
val dataTypesEqual = (values ++ elseValue).map(_.dataType).distinct.size <= 1
allCondBooleans && dataTypesEqual
}
}
Expand Down

0 comments on commit d7315b3

Please sign in to comment.