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

Test datetime type in MariaDB connector #20241

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

abusk
Copy link
Contributor

@abusk abusk commented Dec 29, 2023

Description

Is this change a fix, improvement, new feature, refactoring, or other?
improvement
Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)
MariaDB connector
How would you describe this change to a non-technical end user or system administrator?
Support datetime type in MariaDB connector

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.

Copy link

cla-bot bot commented Dec 29, 2023

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

@github-actions github-actions bot added the docs label Dec 29, 2023
Copy link

cla-bot bot commented Dec 29, 2023

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

.build();

SqlDataTypeTest.create()
.addRoundTrip("datetime(3)", "'1958-01-01 13:18:03.123'", createTimestampType(3), "TIMESTAMP '1958-01-01 13:18:03.123'")
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@ebyhr ebyhr Jan 2, 2024

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.

Copy link
Contributor Author

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.

docs/src/main/sphinx/connector/mariadb.md Outdated Show resolved Hide resolved
@ebyhr
Copy link
Member

ebyhr commented Dec 29, 2023

Added Support for datetime type in MariaDB connector

datetime is already supported as far as I know. Also, please avoid past tense in the commit title.
https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#format-git-commit-messages

@abusk abusk changed the title Added Support for datetime type in MariaDB connector Add Support for datetime type in MariaDB connector Jan 1, 2024
Copy link

cla-bot bot commented Jan 1, 2024

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
Copy link

cla-bot bot commented Jan 1, 2024

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

Copy link

cla-bot bot commented Jan 3, 2024

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

@abusk abusk requested a review from ebyhr January 3, 2024 10:42
Copy link

cla-bot bot commented Jan 3, 2024

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

@abusk
Copy link
Contributor Author

abusk commented Jan 6, 2024

@ebyhr please review the latest PR

@ebyhr ebyhr changed the title Add Support for datetime type in MariaDB connector Test datetime type in MariaDB connector Jan 8, 2024
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.

Please squash commits into one and fix the commit title as "Test datetime type in MariaDB connector"

@abusk abusk force-pushed the support_mariadb_datetime branch from a79d296 to ca41544 Compare January 11, 2024 07:02
@cla-bot cla-bot bot added the cla-signed label Jan 11, 2024
@abusk abusk force-pushed the support_mariadb_datetime branch from ca41544 to acc7ca7 Compare January 11, 2024 07:11
Comment on lines 770 to 772
// 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'")
Copy link
Member

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.

Comment on lines 863 to 864
// 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'")
Copy link
Member

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

Copy link
Contributor Author

@abusk abusk Jan 12, 2024

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@abusk abusk force-pushed the support_mariadb_datetime branch from acc7ca7 to 66471f6 Compare January 12, 2024 07:08
@ebyhr ebyhr force-pushed the support_mariadb_datetime branch from 66471f6 to ea13678 Compare January 14, 2024 23:44
@ebyhr ebyhr merged commit a604d20 into trinodb:master Jan 14, 2024
4 of 13 checks passed
@github-actions github-actions bot added this to the 437 milestone Jan 14, 2024
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.

Add test for datetime type in MariaDB connector
2 participants