Skip to content

Commit 528e373

Browse files
thomastechsyhuai
authored andcommitted
[SPARK-12941][SQL][MASTER] Spark-SQL JDBC Oracle dialect fails to map string datatypes to Oracle VARCHAR datatype mapping
A test suite added for the bug fix -SPARK 12941; for the mapping of the StringType to corresponding in Oracle manual tests done (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests) (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) Author: thomastechs <[email protected]> Author: THOMAS SEBASTIAN <[email protected]> Closes #11489 from thomastechs/thomastechs-12941-master-new. (cherry picked from commit f6ac7c3) Signed-off-by: Yin Huai <[email protected]> Conflicts: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
1 parent 5a27129 commit 528e373

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,10 @@ class JDBCSuite extends SparkFunSuite with BeforeAndAfter with SharedSQLContext
501501
assert(rows(0).getAs[java.sql.Timestamp](2)
502502
=== java.sql.Timestamp.valueOf("2002-02-20 11:22:33.543543"))
503503
}
504+
505+
test("SPARK 12941: The data type mapping for StringType to Oracle") {
506+
val oracleDialect = JdbcDialects.get("jdbc:oracle://127.0.0.1/db")
507+
assert(oracleDialect.getJDBCType(StringType).
508+
map(_.databaseTypeDefinition).get == "VARCHAR2(255)")
509+
}
504510
}

0 commit comments

Comments
 (0)