[SPARK-33743]change TimestampType match to datetime2 instead of datetime for MsSQLServerDialect#32655
Closed
luxu1-ms wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-33743]change TimestampType match to datetime2 instead of datetime for MsSQLServerDialect#32655luxu1-ms wants to merge 2 commits intoapache:masterfrom
luxu1-ms wants to merge 2 commits intoapache:masterfrom
Conversation
|
Can one of the admins verify this patch? |
|
Hi Team, Any ETA on getting this one complete? Thanks, |
|
we also have a lot of conflicts with Datetime2 in MSSQL, is their a plan if this fix is released soon?? |
hmayer1980
pushed a commit
to hmayer1980/sql-spark-connector
that referenced
this pull request
Oct 28, 2021
… pull request apache/spark#32655 is incorporated into your spark enviornment.
|
when could we close / merge the PR? |
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPARK-33743 is to change datetime datatype mapping in JDBC mssqldialect.
What changes were proposed in this pull request?
override def getJDBCType(dt: DataType): Option[JdbcType] = dt match {
case TimestampType => Some(JdbcType("DATETIME2", java.sql.Types.TIMESTAMP))
Why are the changes needed?
Spark datetime type is timestamp type. This supports a microsecond resolution.
Sql supports 2 date time types:
datetime can support only milli seconds resolution (0 to 999).
datetime2 is extension of datetime , is compatible with datetime and supports 0 to 9999999 sub second resolution.
datetime2 (Transact-SQL) - SQL Server | Microsoft Docs
datetime (Transact-SQL) - SQL Server | Microsoft Docs
Currently MsSQLServerDialect maps timestamp type to datetime. Datetime only allows 3 digits of microseconds. This implies results in errors when writing timestamp with more than 3 digits of microseconds to sql server table. We want to map timestamp to datetime2, which is compatible with datetime but allows 7 digits of microseconds.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Unit tests were updated and passed in JDBCSuit.scala.
E2E test done with SQL Server.