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

Add docs for MySQL timestamptz handling #19231

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

adamjshook
Copy link
Member

Description

This adds a note in the MySQL connector documentation about an error users may experience when using timestamptz types due to mismatches between JVM/time zone and what is installed on the MySQL server.

Additional context and related issues

Relates to #18470

Release notes

(X) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Oct 2, 2023
@adamjshook adamjshook marked this pull request as ready for review October 2, 2023 13:52
@adamjshook adamjshook requested review from mosabua and hashhar October 2, 2023 13:52
Comment on lines 282 to 284
To preserve time instants, Trino's use of the MySQL JDBC driver sets the JVM
time zone as the session zone and forces the server's time zone to match the
JVM time zone. Because of this, users may experience an issue if the JVM time
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a native English speaker, but the order of this sentence makes it hard to understand. How about this?

Suggested change
To preserve time instants, Trino's use of the MySQL JDBC driver sets the JVM
time zone as the session zone and forces the server's time zone to match the
JVM time zone. Because of this, users may experience an issue if the JVM time
To preserve time instants, Trino sets the session time zone
of the MySQL connection to match the JVM time zone.
Because of this, users may experience an issue if the JVM time

Copy link
Member Author

Choose a reason for hiding this comment

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

This is much more clear, thank you.

@adamjshook adamjshook force-pushed the adamjshook/trino-timestamp-doc branch from f120e18 to 73d3a9f Compare October 2, 2023 13:59
@github-actions github-actions bot added the docs label Oct 2, 2023
@hashhar
Copy link
Member

hashhar commented Oct 5, 2023

@mosabua @jhlodin can you PTAL?

@@ -276,6 +276,22 @@ this table:

No other types are supported.

### Timestamp type handling

MySQL `TIMESTAMP` types with are mapped to a Trino `TIMESTAMP WITH TIME ZONE`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
MySQL `TIMESTAMP` types with are mapped to a Trino `TIMESTAMP WITH TIME ZONE`.
MySQL `TIMESTAMP` types are mapped to Trino `TIMESTAMP WITH TIME ZONE`.

MySQL `TIMESTAMP` types with are mapped to a Trino `TIMESTAMP WITH TIME ZONE`.
To preserve time instants, Trino sets the session time zone
of the MySQL connection to match the JVM time zone.
Because of this, users may experience an issue if the JVM time
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Because of this, users may experience an issue if the JVM time
As a result, error messages similar to the following example occur when a timezone from the JVM does not exist on the MySQL server:

To preserve time instants, Trino sets the session time zone
of the MySQL connection to match the JVM time zone.
Because of this, users may experience an issue if the JVM time
zone does not exist on the MySQL server, receiving an error similar to:
Copy link
Member

Choose a reason for hiding this comment

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

Remove this line

com.mysql.cj.exceptions.CJException: Unknown or incorrect time zone: 'UTC'
```

Users will need to use a time zone that is known to both the JVM and MySQL,
Copy link
Member

Choose a reason for hiding this comment

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

Replacement paragraph.

To avoid the errors, you must use a time zone that is known on both systems, or [install the missing time zone on the MySQL server](https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html#time-zone-installation).

@adamjshook adamjshook force-pushed the adamjshook/trino-timestamp-doc branch from 73d3a9f to cece6f7 Compare October 9, 2023 12:39
@adamjshook adamjshook requested a review from mosabua October 9, 2023 12:39
This adds a note in the MySQL connector documentation
about an error users may experience when using
timestamptz types due to mismatches between JVM
time zone and what is installed on the MySQL server.
@adamjshook adamjshook force-pushed the adamjshook/trino-timestamp-doc branch from cece6f7 to 6c455da Compare October 9, 2023 12:40
@mosabua mosabua merged commit fdd5927 into trinodb:master Oct 11, 2023
@github-actions github-actions bot added this to the 429 milestone Oct 11, 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.

4 participants