Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20024#discussion_r159574300
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
 ---
    @@ -608,6 +723,22 @@ case class Cast(child: Expression, dataType: DataType, 
timeZoneId: Option[String
             val tz = ctx.addReferenceObj("timeZone", timeZone)
             (c, evPrim, evNull) => s"""$evPrim = UTF8String.fromString(
               
org.apache.spark.sql.catalyst.util.DateTimeUtils.timestampToString($c, $tz));"""
    +      case ar: ArrayType =>
    +        val bufferClass = classOf[StringBuffer].getName
    +        val buffer = ctx.addMutableState(bufferClass, "buffer", v => s"$v 
= new $bufferClass();")
    +        val writeArrayToBuffer = codegenWriteArrayToBuffer(ar, buffer, ctx)
    +        val arrayToStringCode =
    +          s"""
    +             |if (!${ev.isNull}) {
    --- End diff --
    
    why is it? We are in `nullSafeCastFunction`, and ideally we don't need the 
`ev: ExprCode` parameter.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to