diff options
author | thomastechs <thomas.sebastian@tcs.com> | 2016-02-25 22:52:25 -0800 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-02-25 22:52:25 -0800 |
commit | 8afe49141d9b6a603eb3907f32dce802a3d05172 (patch) | |
tree | a7871c801eb7802c9e2d9dd2e25db2098513bd93 /sql/core | |
parent | 50e60e36f7775a10cf39338e7c5716578a24d89f (diff) | |
download | spark-8afe49141d9b6a603eb3907f32dce802a3d05172.tar.gz spark-8afe49141d9b6a603eb3907f32dce802a3d05172.tar.bz2 spark-8afe49141d9b6a603eb3907f32dce802a3d05172.zip |
[SPARK-12941][SQL][MASTER] Spark-SQL JDBC Oracle dialect fails to map string datatypes to Oracle VARCHAR datatype
## What changes were proposed in this pull request?
This Pull request is used for the fix SPARK-12941, creating a data type mapping to Oracle for the corresponding data type"Stringtype" from dataframe. This PR is for the master branch fix, where as another PR is already tested with the branch 1.4
## How was the this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
This patch was tested using the Oracle docker .Created a new integration suite for the same.The oracle.jdbc jar was to be downloaded from the maven repository.Since there was no jdbc jar available in the maven repository, the jar was downloaded from oracle site manually and installed in the local; thus tested. So, for SparkQA test case run, the ojdbc jar might be manually placed in the local maven repository(com/oracle/ojdbc6/11.2.0.2.0) while Spark QA test run.
Author: thomastechs <thomas.sebastian@tcs.com>
Closes #11306 from thomastechs/master.
Diffstat (limited to 'sql/core')
-rw-r--r-- | sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala index 4165c38268..8e432e8f3d 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/OracleDialect.scala @@ -42,4 +42,9 @@ private case object OracleDialect extends JdbcDialect { None } } + + override def getJDBCType(dt: DataType): Option[JdbcType] = dt match { + case StringType => Some(JdbcType("VARCHAR2(255)", java.sql.Types.VARCHAR)) + case _ => None + } } |