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

Return NULL when zero date with convertToNull in Mysql #16028

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

guyco33
Copy link
Member

@guyco33 guyco33 commented Feb 8, 2023

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

@@ -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);
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@ebyhr ebyhr left a 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.

@ebyhr ebyhr merged commit b4d3931 into trinodb:master Feb 10, 2023
@ebyhr ebyhr mentioned this pull request Feb 10, 2023
@github-actions github-actions bot added this to the 407 milestone Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Fail to select a zero datetime values from Mysql
2 participants