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

2017-10-28 Thread viirya
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-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



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

2017-10-28 Thread cloud-fan
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-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org