Skip to content

Commit b88cabb

Browse files
Eugene-Markwangyum
authored andcommitted
[SPARK-39604][SQL][TESTS] Add UT for DerbyDialect getCatalystType method
### What changes were proposed in this pull request? Add complemented UT for DerbyDialect ### Why are the changes needed? Add UT for existed key function. If conversion from original data source to Spark data type is needed, the `getCatalystType` method will be added to specific ${data-source}Dialect class. It's needed to add UT for each of them. Currently, all *Dialect class has UT to cover the method except DerbyDialect. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unit Test Closes #36993 from Eugene-Mark/derby-catalyst-UT. Authored-by: Eugene-Mark <eugene.ma.twenty@gmail.com> Signed-off-by: Yuming Wang <yumwang@ebay.com>
1 parent 702539a commit b88cabb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,13 @@ class JDBCSuite extends QueryTest
924924
assert(derbyDialect.getJDBCType(BooleanType).map(_.databaseTypeDefinition).get == "BOOLEAN")
925925
}
926926

927+
test("SPARK-39604: DerbyDialect catalyst type mapping") {
928+
val derbyDialect = JdbcDialects.get("jdbc:derby:db")
929+
val metadata = new MetadataBuilder().putString("name", "test_column")
930+
assert(derbyDialect.getCatalystType(java.sql.Types.REAL, "real",
931+
0, metadata) == Some(FloatType))
932+
}
933+
927934
test("OracleDialect jdbc type mapping") {
928935
val oracleDialect = JdbcDialects.get("jdbc:oracle")
929936
val metadata = new MetadataBuilder().putString("name", "test_column").putLong("scale", -127)

0 commit comments

Comments
 (0)