You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/01/10 07:55:17 UTC

[GitHub] dongjoon-hyun commented on a change in pull request #23456: [SPARK-26538][SQL] Set default precision and scale for elements of postgres numeric array

dongjoon-hyun commented on a change in pull request #23456: [SPARK-26538][SQL] Set default precision and scale for elements of postgres numeric array
URL: https://github.com/apache/spark/pull/23456#discussion_r246661712
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala
 ##########
 @@ -60,7 +60,12 @@ private object PostgresDialect extends JdbcDialect {
     case "bytea" => Some(BinaryType)
     case "timestamp" | "timestamptz" | "time" | "timetz" => Some(TimestampType)
     case "date" => Some(DateType)
-    case "numeric" | "decimal" => Some(DecimalType.bounded(precision, scale))
+    case "numeric" | "decimal" => if (precision > 0) {
+      Some(DecimalType.bounded(precision, scale))
+    } else {
+      // SPARK-26538: handle numeric without explicit precision and scale.
+      Some(DecimalType. SYSTEM_DEFAULT)
+    }
 
 Review comment:
   Hi, @a-shkarupin .
   Could you follow the existing style?
   - https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala#L215-L217

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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