You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2017/10/29 11:41:12 UTC

[GitHub] spark pull request #19567: [SPARK-22291][SQL] Conversion error when transfor...

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

    https://github.com/apache/spark/pull/19567#discussion_r147578399
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,10 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            // some underling types are not String such as uuid, inet, cidr, etc.
    +            array.asInstanceOf[Array[java.lang.Object]]
    +              .map(obj => UTF8String.fromString(
    +                if (obj == null) null else obj.toString))
    --- End diff --
    
    nit: `if (obj == null) null else UTF8String.fromString(obj.toString)`


---

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