Github user chenghao-intel commented on a diff in the pull request:
https://github.com/apache/spark/pull/3150#discussion_r19997794
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
@@ -323,28 +371,53 @@ case class Cast(child: Expression, dataType:
DataType) extends UnaryExpression w
buildCast[Date](_, d => dateToDouble(d))
case TimestampType =>
buildCast[Timestamp](_, t => timestampToDouble(t).toFloat)
- case DecimalType() =>
- buildCast[Decimal](_, _.toFloat)
case x: NumericType =>
b => x.numeric.asInstanceOf[Numeric[Any]].toFloat(b)
}
- private[this] lazy val cast: Any => Any = dataType match {
+ private[this] def castArray(from: ArrayType, to: ArrayType): Any => Any
= {
+ val elementCast = cast(from.elementType, to.elementType)
+ buildCast[Seq[Any]](_, _.map(v => if (v == null) null else
elementCast(v)))
--- End diff --
Semantically, how do we handle the case where`ArrayType.nullable=false`?
---
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]