-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Return NULL when zero date with convertToNull in Mysql #16028
Conversation
@@ -496,7 +497,7 @@ public boolean isNull(ResultSet resultSet, int columnIndex) | |||
throws SQLException | |||
{ | |||
// super calls ResultSet#getObject(), which for TIMESTAMP type returns java.sql.Timestamp, for which the conversion can fail if the value isn't a valid instant in server's time zone. | |||
resultSet.getObject(columnIndex, String.class); | |||
resultSet.getObject(columnIndex, LocalDateTime.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the above comment still valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResultSet#getObject()
also solves this issue, but since it returns java.sql.Timestamp
for both Mysql datetime
and timestamp
I prefer to set the exact type used by the StandardColumnMappings#timestampReadFunction
and not to fail with any other corner case values.
I think that if we keep the override of isNull()
than the comment is not relevant anyway.
plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/TestMySqlTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/TestMySqlTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/TestingMySqlServer.java
Outdated
Show resolved
Hide resolved
plugin/trino-mysql/src/test/java/io/trino/plugin/mysql/TestMySqlTypeMapping.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you fix check style failure?
src/test/java/io/trino/plugin/mysql/TestMySqlTypeMapping.java:[955,14] (indentation) Indentation: 'try resource' has incorrect indentation level 13, expected level should be 16.
Description
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(x) Release notes are required, with the following suggested text:
Fix #16027