You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by jmchung <gi...@git.apache.org> on 2017/10/24 18:57:58 UTC

[GitHub] spark pull request #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Con...

GitHub user jmchung opened a pull request:

    https://github.com/apache/spark/pull/19567

    [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion Error

    ## What changes were proposed in this pull request?
    
    This PR fixes the conversion error when reads data from a PostgreSQL table that contains columns of `UUID[]` data type. 
    
    For example, create a table with the UUID[] data type, and insert the test data.
    ```SQL
    CREATE TABLE users
    (
        id smallint NOT NULL,
        name character varying(50),
        user_ids uuid[],
        PRIMARY KEY (id)
    )
    
    INSERT INTO users ("id", "name","user_ids") 
    VALUES (1, 'foo', ARRAY
        ['7be8aaf8-650e-4dbb-8186-0a749840ecf2'
        ,'205f9bfc-018c-4452-a605-609c0cfad228']::UUID[]
    )
    ```
    Then it will throw the following exceptions when trying to load the data.
    ```
    java.lang.ClassCastException: [Ljava.util.UUID; cannot be cast to [Ljava.lang.String;
        at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$14.apply(JdbcUtils.scala:459)
        at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$14.apply(JdbcUtils.scala:458)
    ...
    ```
    
    
    ## How was this patch tested?
    
    Existing tests.
    
    I try to imitate the tests with above case in `JDBCSuite`, but the `ARRAY` is unsupported type now. Therefore I took the above example in my Postgres and verified by the following code.
    
    ```scala
    val opts = Map(
          "url" -> "jdbc:postgresql://localhost:5432/postgres?user=postgres&password=postgres",
          "dbtable" -> "users")
    val df = spark.read.format("jdbc").options(opts).load()
    df.show(truncate = false)
    
    +---+----+----------------------------------------------------------------------------+
    |id |name|user_ids                                                                    |
    +---+----+----------------------------------------------------------------------------+
    |1  |foo |[7be8aaf8-650e-4dbb-8186-0a749840ecf2, 205f9bfc-018c-4452-a605-609c0cfad228]|
    +---+----+----------------------------------------------------------------------------+
    
    ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jmchung/spark SPARK-22291

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/19567.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #19567
    
----
commit d84b1bb89e3be33931531345fb23cadd8fe6868f
Author: Jen-Ming Chung <je...@gmail.com>
Date:   2017-10-24T18:24:43Z

    [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion Error

----


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    cc @HyukjinKwon @cloud-fan Please help trigger the jenkins test if you have time. Thanks.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83183/
    Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83190 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83190/testReport)** for PR 19567 at commit [`588902d`](https://github.com/apache/spark/commit/588902d21fb12bf80169edc74097d7bda950668c).


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83195 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83195/testReport)** for PR 19567 at commit [`fae5c45`](https://github.com/apache/spark/commit/fae5c455b4a754128bc9112bbead4aef3cc322a2).


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83190 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83190/testReport)** for PR 19567 at commit [`588902d`](https://github.com/apache/spark/commit/588902d21fb12bf80169edc74097d7bda950668c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringTyp...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147569347
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    --- End diff --
    
    Ok. Then we remove this UUID pattern and only have used `Array[java.lang.Object]`.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringType: Conv...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83145/
    Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83195 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83195/testReport)** for PR 19567 at commit [`fae5c45`](https://github.com/apache/spark/commit/fae5c455b4a754128bc9112bbead4aef3cc322a2).
     * This patch **fails PySpark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83183 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83183/testReport)** for PR 19567 at commit [`f3d45d0`](https://github.com/apache/spark/commit/f3d45d01b2e837d04143ac2a038aa616e5ecbfa3).


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147314628
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    +                  .map(uuid => UTF8String.fromString(uuid.toString))
    +              case _ =>
    --- End diff --
    
    I was wrong, org.postgresql.util.PGobject cannot be cast to java.lang.String.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147316748
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    --- End diff --
    
    Yes, Object can cover the UUID since it's a Superclass in Java. Should we not clearly distinguish between classes? Would you mind giving some comments? Thanks!


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Thanks @wangyum and @viirya, I'll add the corresponding tests in `PostgresIntegrationSuite`.
    To @viirya , I'm not sure if the other data types will work,  will consider them into tests, thanks!


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    @jmchung can you send a new PR for 2.2? thanks!


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    cc @viirya Can you help review this? Thanks.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    the last commit just change the test name and shouldn't break pyspark tests, I'm merging to master, thanks!


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    add to whitelist


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    ok to test


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83195/
    Test FAILed.


---

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


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

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/19567


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringType: Conv...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147305034
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    --- End diff --
    
    Can this also be covered by the following `Array[java.lang.Object]`?


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringType: Conv...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    This is not just for UUID[] for now. We should update the PR title.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Thanks @viirya, the title has been changed. Please correct me if the modified title is still inappropriate.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147309952
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    +                  .map(uuid => UTF8String.fromString(uuid.toString))
    +              case _ =>
    --- End diff --
    
    Will it be more appropriate to use `obj.asInstanceOf[String]` to convert?


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    @jmchung There are another StringType types "json", "jsonb" in `PostgresDialect`. Can you also add them into tests?  Thanks.



---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Thanks @HyukjinKwon :)


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83145 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83145/testReport)** for PR 19567 at commit [`edc5f6f`](https://github.com/apache/spark/commit/edc5f6f28846b4b83c21366228b68fba25db7864).


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringType: Conv...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    LGTM except one comment, good catch!


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    LGTM


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringType: Conv...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83145 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83145/testReport)** for PR 19567 at commit [`edc5f6f`](https://github.com/apache/spark/commit/edc5f6f28846b4b83c21366228b68fba25db7864).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83103 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83103/testReport)** for PR 19567 at commit [`040e369`](https://github.com/apache/spark/commit/040e36968cd13550ad05a958b06bf3d21cdf1c64).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83116 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83116/testReport)** for PR 19567 at commit [`0998a77`](https://github.com/apache/spark/commit/0998a775bfd0e73c9e875f32218ab0454d6180ee).


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    gentle ping @wangyum and @viirya, the test case has been added to `PostgresIntegrationSuite`. As @viirya mentioned early, data types `inet[]` and `cidr[]` did not work as for instance of String, they are both mapped to Java's Object class.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] PostgreSQL UUID[] to StringTyp...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147560424
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    --- End diff --
    
    looking at how we handle StringType, we call `ResultSet.getString` even if the underling type is not string, but uuid, inet, cidr, etc. I think we shoud follow the behavior here, i.e. just call `array.asInstanceOf[Array[java.lang.Object]].map(obj => UTF8String.fromString(obj.toString))`


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147312311
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala ---
    @@ -18,7 +18,7 @@
     package org.apache.spark.sql.jdbc
     
     import java.sql.Connection
    -import java.util.Properties
    +import java.util.{Properties, UUID}
    --- End diff --
    
    Thanks! Remove the unused import statement.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147542014
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala ---
    @@ -134,11 +149,28 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
         assert(schema(1).dataType == ShortType)
       }
     
    -  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE should be recognized") {
    +  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE " +
    +    "should be recognized") {
         val dfRead = sqlContext.read.jdbc(jdbcUrl, "ts_with_timezone", new Properties)
         val rows = dfRead.collect()
         val types = rows(0).toSeq.map(x => x.getClass.toString)
         assert(types(1).equals("class java.sql.Timestamp"))
         assert(types(2).equals("class java.sql.Timestamp"))
       }
    +
    +  test("SPARK-22291: Postgresql UUID[] to Cassandra: Conversion Error") {
    --- End diff --
    
    Thanks @gatorsmile and `Cassandra` has been removed. Feel free to correct me if the revised title is inappropriate. Do you have more comments? 


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83116 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83116/testReport)** for PR 19567 at commit [`0998a77`](https://github.com/apache/spark/commit/0998a775bfd0e73c9e875f32218ab0454d6180ee).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83103 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83103/testReport)** for PR 19567 at commit [`040e369`](https://github.com/apache/spark/commit/040e36968cd13550ad05a958b06bf3d21cdf1c64).


---

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


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

Posted by cloud-fan <gi...@git.apache.org>.
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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83103/
    Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83116/
    Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra: Conve...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Besides uuid, other PostgreSQL types such as  "cidr", "inet", they are treated as StringType too, will they work?


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    LGTM too


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147305235
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala ---
    @@ -18,7 +18,7 @@
     package org.apache.spark.sql.jdbc
     
     import java.sql.Connection
    -import java.util.Properties
    +import java.util.{Properties, UUID}
    --- End diff --
    
    Do we use `UUID` here?


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Seems that we don't even have test against uuid column, when you create test for uuid[], can you also create test for uuid? Thanks.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147317145
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    --- End diff --
    
    Having a separate case for UUID is more clear to me and maybe easy to debug in the future. However I'm not sure how long this matching cases can be grown.


---

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


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

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147581349
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala ---
    @@ -134,11 +149,28 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
         assert(schema(1).dataType == ShortType)
       }
     
    -  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE should be recognized") {
    +  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE " +
    +    "should be recognized") {
         val dfRead = sqlContext.read.jdbc(jdbcUrl, "ts_with_timezone", new Properties)
         val rows = dfRead.collect()
         val types = rows(0).toSeq.map(x => x.getClass.toString)
         assert(types(1).equals("class java.sql.Timestamp"))
         assert(types(2).equals("class java.sql.Timestamp"))
       }
    +
    +  test("SPARK-22291: PostgreSQL UUID[] to StringType: Conversion Error") {
    --- End diff --
    
    Oops, I forgot it, thanks!!


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    **[Test build #83183 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83183/testReport)** for PR 19567 at commit [`f3d45d0`](https://github.com/apache/spark/commit/f3d45d01b2e837d04143ac2a038aa616e5ecbfa3).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147531601
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala ---
    @@ -134,11 +149,28 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
         assert(schema(1).dataType == ShortType)
       }
     
    -  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE should be recognized") {
    +  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE " +
    +    "should be recognized") {
         val dfRead = sqlContext.read.jdbc(jdbcUrl, "ts_with_timezone", new Properties)
         val rows = dfRead.collect()
         val types = rows(0).toSeq.map(x => x.getClass.toString)
         assert(types(1).equals("class java.sql.Timestamp"))
         assert(types(2).equals("class java.sql.Timestamp"))
       }
    +
    +  test("SPARK-22291: Postgresql UUID[] to Cassandra: Conversion Error") {
    --- End diff --
    
    This is not related to `Cassandra `. Please remove it from the test case name and the PR title. 


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark pull request #19567: [SPARK-22291][SQL] Postgresql UUID[] to Cassandra...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147309380
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala ---
    @@ -456,8 +456,17 @@ object JdbcUtils extends Logging {
     
             case StringType =>
               (array: Object) =>
    -            array.asInstanceOf[Array[java.lang.String]]
    -              .map(UTF8String.fromString)
    +            array match {
    +              case _: Array[java.lang.String] =>
    +                array.asInstanceOf[Array[java.lang.String]]
    +                  .map(UTF8String.fromString)
    +              case _: Array[java.util.UUID] =>
    +                array.asInstanceOf[Array[java.util.UUID]]
    +                  .map(uuid => UTF8String.fromString(uuid.toString))
    +              case _ =>
    --- End diff --
    
    I can't currently take a close look now (it's mobile) but is it safe (or related) to allow the conversion from obj to string?


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by wangyum <gi...@git.apache.org>.
Github user wangyum commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Please add tests to https://github.com/apache/spark/blob/master/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    gentle ping @cloud-fan and @viirya, there are some feedbacks about the behavior of obj to string.
    
    ``` scala
    case StringType =>
      (array: Object) =>
        array.asInstanceOf[Array[java.lang.Object]]
          .map(obj => UTF8String.fromString(obj.toString))
    ```
    As @HyukjinKwon mentioned before, it may unsafe to covnert the object to string directly, we'll have the `java.lang.NullPointerException` in test cases. `StringType` is different from other types use `nullSafeConvert` method to deal with the null, it process within `UTF8String.fromString`.
    
    The `UTF8String.fromString` returns null and UTF8String so that we cannot use `String.valueOf(obj)` to avoid the NPE, it will raise another errors (because `null != "null"`):
    
    ```
    - Type mapping for various types *** FAILED ***
      Array("a", "null", "b") did not equal List("a", null, "b") (PostgresIntegrationSuite.scala:120)
     ``` 
    
    IMHO, if we don't want to make separation of match cases, we may remain null to meet the original design, e.g.,
    
    ``` scala
    case StringType =>
      (array: Object) =>
        array.asInstanceOf[Array[java.lang.Object]]
          .map(obj => UTF8String.fromString(
            if (obj == null) null else obj.toString))
    ```
    
    Alternative is we keep the String and Object cases?
    
    Would you mind give some comments? I can keep working on this :)


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    LGTM


---

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


[GitHub] spark issue #19567: [SPARK-22291] Postgresql UUID[] to Cassandra: Conversion...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    @jmchung You can add unit test into `PostgresIntegrationSuite`.


---

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


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

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147581064
  
    --- Diff: external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala ---
    @@ -134,11 +149,28 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
         assert(schema(1).dataType == ShortType)
       }
     
    -  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE should be recognized") {
    +  test("SPARK-20557: column type TIMESTAMP with TIME ZONE and TIME with TIME ZONE " +
    +    "should be recognized") {
         val dfRead = sqlContext.read.jdbc(jdbcUrl, "ts_with_timezone", new Properties)
         val rows = dfRead.collect()
         val types = rows(0).toSeq.map(x => x.getClass.toString)
         assert(types(1).equals("class java.sql.Timestamp"))
         assert(types(2).equals("class java.sql.Timestamp"))
       }
    +
    +  test("SPARK-22291: PostgreSQL UUID[] to StringType: Conversion Error") {
    --- End diff --
    
    Let's change this test title too.


---

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


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

Posted by jmchung <gi...@git.apache.org>.
Github user jmchung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19567#discussion_r147579149
  
    --- 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 --
    
    Thanks @cloud-fan !


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83190/
    Test PASSed.


---

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


[GitHub] spark issue #19567: [SPARK-22291][SQL] Conversion error when transforming ar...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/19567
  
    Merged build finished. Test FAILed.


---

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