Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/20024#discussion_r159588015
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
@@ -203,9 +203,26 @@ case class Cast(child: Expression, dataType: DataType,
timeZoneId: Option[String
// UDFToString
private[this] def castToString(from: DataType): Any => Any = from match {
case BinaryType => buildCast[Array[Byte]](_, UTF8String.fromBytes)
+ case StringType => buildCast[UTF8String](_, identity)
case DateType => buildCast[Int](_, d =>
UTF8String.fromString(DateTimeUtils.dateToString(d)))
case TimestampType => buildCast[Long](_,
t => UTF8String.fromString(DateTimeUtils.timestampToString(t,
timeZone)))
+ case ar: ArrayType =>
+ buildCast[ArrayData](_, array => {
+ val res = new StringBuilder
+ res.append("[")
+ if (array.numElements > 0) {
--- End diff --
yea, ok
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]