Github user mn-mikke commented on a diff in the pull request:
https://github.com/apache/spark/pull/21687#discussion_r199426921
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala
---
@@ -129,7 +129,7 @@ case class CaseWhen(
case Seq(dt1, dt2) => dt1.sameType(dt2)
}
- override def dataType: DataType = branches.head._2.dataType
+ override def dataType: DataType =
valueTypes.reduce(TypeCoercion.findTightestCommonType(_, _).get)
--- End diff --
Yeah, the types are ```sameType``` equal (ignoring nullability). I just
leveraging ```TypeCoercion.findTightestCommonType``` for merging ```nullable```
and ```containsNull``` flags.
I can introduce a new method for this purpose, but I'm afraid that the
implementation will be very similar to
```TypeCoercion.findTightestCommonType```.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]