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

Added Correctness Tests For Date And Time Functions #1298

Merged

Conversation

matthewryanwells
Copy link
Contributor

Signed-off-by: Matthew Wells matthew.wells@improving.com

Description

Wrote correctness tests for date and time functions, some tests were not including due to them failing.

All string functions that have no been included in the test is because they either aren't implemented in OpenSearch, or they aren't implemented in H2 and SQLite. Because of the small number of string functions in SQLite and the fact that all correctness tests need to pass against at least one database all functions are taken from the overlap of functions between OpenSearch and H2. All functions that are implemented in both OpenSearch and H2 that do not pass have their specific reasons for failure mentioned below.

  • TIME does not work when adding milliseconds because of a bug
  • DAY_OF_WEEK() on H2 returns a value 1 higher than on OpenSearch
  • WEEK() on H2 returns a value 1 higher than on OpenSearch
  • CURRENT_WEEK() on H2 returns a value that is sometimes 1 higher than on OpenSearch due to a difference in timezone
  • CURRENT_TIME() on H2 returns a TIME WITH TIME ZONE whereas OpenSearch returns a TIME as well as a different time due to different timezone
  • CURRENT_TIMESTAMP() on H2 returns a TIME WITH TIME ZONE whereas OpenSearch returns a TIME as well as a different time and sometimes date due to different timezone
  • DATEDIFF() on OpenSearch takes in two DATE parameters and returns the difference in days while H2 takes in a third parameter for time period to be returned

Issue

#722

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

* Added correctness tests for date and time functions

Signed-off-by: Matthew Wells <matthew.wells@improving.com>

* updated tests to include test data

Signed-off-by: Matthew Wells <matthew.wells@improving.com>

---------

Signed-off-by: Matthew Wells <matthew.wells@improving.com>
@matthewryanwells matthewryanwells requested a review from a team as a code owner January 27, 2023 18:40
@dai-chen dai-chen added the infrastructure Changes to infrastructure, testing, CI/CD, pipelines, etc. label Jan 27, 2023
@dai-chen dai-chen merged commit cfe6802 into opensearch-project:main Feb 1, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 1, 2023
* Added correctness tests for date and time functions

* updated tests to include test data

---------

Signed-off-by: Matthew Wells <matthew.wells@improving.com>
(cherry picked from commit cfe6802)
Yury-Fridlyand pushed a commit that referenced this pull request Feb 2, 2023
* Added correctness tests for date and time functions

* updated tests to include test data

---------

Signed-off-by: Matthew Wells <matthew.wells@improving.com>
(cherry picked from commit cfe6802)

Co-authored-by: Matthew Wells <matthew.wells@improving.com>
GabeFernandez310 pushed a commit to Bit-Quill/opensearch-project-sql that referenced this pull request Feb 2, 2023
…ct#1298)

* Added correctness tests for date and time functions



* updated tests to include test data



---------

Signed-off-by: Matthew Wells <matthew.wells@improving.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x infrastructure Changes to infrastructure, testing, CI/CD, pipelines, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants