Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme do include datetime2(0) not being supported until spark… #157

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hmayer1980
Copy link

Can we please include in the known Issues the fact that datetime2(0) is not supported - as shown by issues #39 and #83.
This will really only fix until the Spark Pull Request is incorporated - and is it takes month or never happen - we need to have that noted.

… pull request apache/spark#32655 is incorporated into your spark enviornment.

… pull request apache/spark#32655 is incorporated into your spark enviornment.
@ruiyang2015
Copy link

is it possible for the sql spark connector to truncate the datetime value instead of throwing the connection closed error? seems to strict for this case.

@hmayer1980
Copy link
Author

not that I know of

@@ -102,6 +102,15 @@ connectionProperties = {

For more information and explanation, visit the closed [issue](https://github.com/microsoft/sql-spark-connector/issues/26).

### datetime2(0) will result in com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed

This issue arises from Spark not supporting datetime2.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQL Datetime data type only allows 3 digits fractional seconds while spark dataframe might have more digits than datatime allows. The two workarounds, 1. truncate datetime in spark dataframe to 3 digits of milliseconds. 2. sql table column use datatime2 data type, which allows 7 digits of fractional seconds.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @luxu1-ms , the workarounds are clear and are documented in the two references issues. The points - if your SQL Table has datetime2(0) datetype it just does not work - so this needs to be documented!
If you can not change the SQL Table away from datetime2(0) to any other datetime2(x) where x>0 the connector wont work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants