[SPARK-35893][TESTS] Add unit test case for MySQLDialect.getCatalystType
### What changes were proposed in this pull request? Add unit test case for MySQLDialect.getCatalystType ### Why are the changes needed? add unit test case ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unit Test Closes #33087 from zengruios/SPARK-35893. Authored-by: zengruios <578395184@qq.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This commit is contained in:
parent
def29e5075
commit
b11b175148
|
@ -899,6 +899,17 @@ class JDBCSuite extends QueryTest
|
|||
Option(TimestampType))
|
||||
}
|
||||
|
||||
test("MySQLDialect catalyst type mapping") {
|
||||
val mySqlDialect = JdbcDialects.get("jdbc:mysql")
|
||||
val metadata = new MetadataBuilder()
|
||||
assert(mySqlDialect.getCatalystType(java.sql.Types.VARBINARY, "BIT", 2, metadata) ==
|
||||
Some(LongType))
|
||||
assert(metadata.build().contains("binarylong"))
|
||||
assert(mySqlDialect.getCatalystType(java.sql.Types.VARBINARY, "BIT", 1, metadata) == None)
|
||||
assert(mySqlDialect.getCatalystType(java.sql.Types.BIT, "TINYINT", 1, metadata) ==
|
||||
Some(BooleanType))
|
||||
}
|
||||
|
||||
test("SPARK-35446: MySQLDialect type mapping of float") {
|
||||
val mySqlDialect = JdbcDialects.get("jdbc:mysql://127.0.0.1/db")
|
||||
assert(mySqlDialect.getJDBCType(FloatType).map(_.databaseTypeDefinition).get == "FLOAT")
|
||||
|
|
Loading…
Reference in a new issue