-
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
Test datetime type in MariaDB connector #20241
Conversation
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
plugin/trino-mariadb/src/main/java/io/trino/plugin/mariadb/MariaDbClient.java
Outdated
Show resolved
Hide resolved
.build(); | ||
|
||
SqlDataTypeTest.create() | ||
.addRoundTrip("datetime(3)", "'1958-01-01 13:18:03.123'", createTimestampType(3), "TIMESTAMP '1958-01-01 13:18:03.123'") |
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.
Please update testTimestamp(ZoneId sessionZone)
method to accept both timestamp and datetime.
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.
MariaDB stores values that use the DATETIME data type in a format that supports values between 1000-01-01 00:00:00.000000 and 9999-12-31 23:59:59.999999
which is different from TIMESTAMP (https://mariadb.com/kb/en/timestamp/#supported-values). As the test cases has different ranges of values, so it is better to keep in separate.
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.
Please leave the code comment and add roundtip with min and max values.
Also, we can still extract the common roundtrips.
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.
Yea, adding a common roudrips method for datetime and timestamp test.
|
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/BaseMariaDbConnectorTest.java
Outdated
Show resolved
Hide resolved
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
1 similar comment
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
@ebyhr please review the latest PR |
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.
Please squash commits into one and fix the commit title as "Test datetime type in MariaDB connector"
plugin/trino-mariadb/src/main/java/io/trino/plugin/mariadb/MariaDbClient.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
plugin/trino-mariadb/src/test/java/io/trino/plugin/mariadb/TestMariaDbTypeMapping.java
Outdated
Show resolved
Hide resolved
a79d296
to
ca41544
Compare
ca41544
to
acc7ca7
Compare
// min value 1970-01-01 00:00:00 | ||
.addRoundTrip("timestamp(3)", "TIMESTAMP '1970-01-01 00:00:01.000'", createTimestampType(3), "TIMESTAMP '1970-01-01 00:00:01.000'") | ||
.addRoundTrip("timestamp(6)", "TIMESTAMP '1970-01-01 00:00:01.000000'", createTimestampType(6), "TIMESTAMP '1970-01-01 00:00:01.000000'") |
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.
The min value in a comment is different from the roundtrip.
// min value 1000-01-01 00:00:00 | ||
.addRoundTrip("datetime(3)", "TIMESTAMP '1000-01-01 00:00:00.000'", createTimestampType(3), "TIMESTAMP '1000-01-01 00:00:00.000'") |
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.
This value isn't the min value in MariaDB as far as I confirmed:
create table tpch.test(a datetime);
insert into tpch.test values (TIMESTAMP '0999-12-31 00:00:00.000');
select * from tpch.test; -- 0999-12-31 00:00:00.000
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.
Ah it is supporting min value of 0001-01-01 00:00:00
. I followed this doc https://mariadb.com/kb/en/datetime/#supported-values where mentioned min value is 1000-01-01 00:00:00
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.
updated
acc7ca7
to
66471f6
Compare
66471f6
to
ea13678
Compare
Description
Additional context and related issues
Fixes #17242
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.