yaooqinn commented on code in PR #45666:
URL: https://github.com/apache/spark/pull/45666#discussion_r1535998312
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -938,9 +938,17 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
Some(BooleanType))
assert(mySqlDialect.getCatalystType(java.sql.Types.TINYINT, "TINYINT", 1,
metadata) ==
Some(ByteType))
+ assert(mySqlDialect.getCatalystType(java.sql.Types.REAL, "FLOAT", 1,
metadata) ===
+ Some(FloatType))
+ assert(mySqlDialect.getCatalystType(java.sql.Types.FLOAT, "FLOAT", 1,
metadata) ===
+ Some(FloatType))
metadata.putBoolean("isSigned", value = false)
assert(mySqlDialect.getCatalystType(java.sql.Types.TINYINT, "TINYINT", 1,
metadata) ===
Some(ShortType))
+ assert(mySqlDialect.getCatalystType(java.sql.Types.REAL, "FLOAT", 1,
metadata) ===
+ Some(DoubleType))
+ assert(mySqlDialect.getCatalystType(java.sql.Types.FLOAT, "FLOAT", 1,
metadata) ===
+ Some(DoubleType))
Review Comment:
Hi @dongjoon-hyun, this is a good point.
A `float(p)` can represent a single-precision float when p <= 23 and
double-precision when p > 23 in MySQL. This is already handled by
mysql-connect/j, so we get java.sql.Types.FLOAT/REAL for the former and
java.sql.Types.DOUBLE for the latter. We do not need to worry about the case
that we use our `FloatType` to get a MySQL Float(p>23).
--
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]