pan3793 commented on code in PR #52947:
URL: https://github.com/apache/spark/pull/52947#discussion_r2507052504


##########
sql/connect/client/jdbc/src/main/scala/org/apache/spark/sql/connect/client/jdbc/util/JdbcTypeUtils.scala:
##########
@@ -90,6 +96,7 @@ private[jdbc] object JdbcTypeUtils {
     case DoubleType => 24
     case StringType =>
       getPrecision(field)
+    case DecimalType.Fixed(p, s) => p + (if (s == 0) 0 else 1)

Review Comment:
   I think we should consider more cases, for example,
   ```scala
       // scale = precision => only fractional digits. +3 for decimal point, 
sign and leading zero
       case DecimalType.Fixed(p, s) if s == p => p + 3
       // scale = 0 => only integral part. +1 for sign
       case DecimalType.Fixed(p, s) if s == 0 => p + 1
       // scale > 0 => both integral and fractional part. +2 for sign and 
decimal point
       case DecimalType.Fixed(p, s) => p + 2
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to