spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request #20024: [SPARK-22825][SQL] Fix incorrect results of Casti...
Date Thu, 04 Jan 2018 06:48:48 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20024#discussion_r159588472
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
    @@ -608,6 +667,20 @@ 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 =>
    +        (c, evPrim, evNull) => {
    +          val bufferTerm = ctx.freshName("bufferTerm")
    +          val bufferClass = classOf[StringBuffer].getName
    +          val writeArrayToBuffer = codegenWriteArrayToBuffer(ar, ctx)
    +          s"""
    +             |$bufferClass $bufferTerm = new $bufferClass();
    +             |if (!$evNull) {
    --- End diff --
    
    looking at the document of `CastFunction`, the `evNull` is actually `resultIsNull`, it's
not about input but about result, so we should not check it here.


---

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


Mime
View raw message