Repository: spark Updated Branches: refs/heads/master 94fc57afd -> c14aee4da
[SPARK-10856][SQL] Mapping TimestampType to DATETIME for SQL Server jdbc dialect JIRA: https://issues.apache.org/jira/browse/SPARK-10856 For Microsoft SQL Server, TimestampType should be mapped to DATETIME instead of TIMESTAMP. Related information for the datatype mapping: https://msdn.microsoft.com/en-us/library/ms378878(v=sql.110).aspx Author: Liang-Chi Hsieh <[email protected]> Closes #8978 from viirya/mysql-jdbc-timestamp. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c14aee4d Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c14aee4d Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c14aee4d Branch: refs/heads/master Commit: c14aee4da97d4a7fcc8a2565a159edc74a5c8e10 Parents: 94fc57a Author: Liang-Chi Hsieh <[email protected]> Authored: Wed Oct 7 14:49:08 2015 -0700 Committer: Reynold Xin <[email protected]> Committed: Wed Oct 7 14:49:08 2015 -0700 ---------------------------------------------------------------------- .../src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/c14aee4d/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala index c70fea1..5abbfbf 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala @@ -277,4 +277,9 @@ case object MsSqlServerDialect extends JdbcDialect { Some(StringType) } else None } + + override def getJDBCType(dt: DataType): Option[JdbcType] = dt match { + case TimestampType => Some(JdbcType("DATETIME", java.sql.Types.TIMESTAMP)) + case _ => None + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
