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

Fixed DateTimeFunctionTest.testWeekOfYearWithTimeType and YearWeekTestt.testYearWeekWithTimeType Test Failures #3235

Merged

Conversation

kenrickyap
Copy link
Contributor

@kenrickyap kenrickyap commented Jan 9, 2025

Description

Certain tests failed due to inconsistencies with how ISO 8601 and how opensearch sql calculates number of weeks since start of year. Specifically ISO 8601 calculates weeks using the following criteria:

  • Weeks start on Monday
  • The first week of a year is any week containing 4 or more days in the new year.

Whereas YEARWEEK counts only full weeks, where weeks start on Sunday. To fix the discrepancy we find the first Sunday of the year and start counting weeks from that date.

Related Issues

Resolves #2477

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

…t.testYearWeekWithTimeType test failures

Signed-off-by: Kenrick Yap <[email protected]>
Signed-off-by: Kenrick Yap <[email protected]>
@LantaoJin
Copy link
Member

LantaoJin commented Jan 10, 2025

@kenrickyap could this patch address the flaky test listed in and workaround by PR #3225? If yes, please update that test too.

@kenrickyap
Copy link
Contributor Author

kenrickyap commented Jan 10, 2025

@kenrickyap could this patch address the flaky test listed in and workaround by PR #3225? If yes, please update that test too.

@LantaoJin I have tried to apply the same logic but for some reason the unit test is still failing after I remove the check for January and December. Will spend a little more time to find a solution!

acarbonetto
acarbonetto previously approved these changes Jan 13, 2025
YANG-DB
YANG-DB previously approved these changes Jan 14, 2025
Copy link
Member

@LantaoJin LantaoJin left a comment

Choose a reason for hiding this comment

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

#3235 (comment)

any update?

@kenrickyap kenrickyap dismissed stale reviews from YANG-DB and acarbonetto via 67b81f1 January 14, 2025 16:15
@kenrickyap
Copy link
Contributor Author

#3235 (comment)

any update?

Have found fix for #3225. However, in finding the fix have identified inconsistency of behaviour between extract and yearweek implementation. Specifically, extract is calculating week_of_year using java.time libaray (setting Local to Local.English) where as yearweek using CalendarLookup.getWeekNumber (to align with MySQL). Depending on which function users use, they will get a different value.

I believe it would be best to align the behaviour of extract and yearweek. However as the current test are failing and preventing other PRs from being merge, we should merge this ticket asap and aim to align function behaviour in another ticket

@kenrickyap
Copy link
Contributor Author

@YANG-DB @acarbonetto @LantaoJin would we be able to review and merge this ticket? Currently the above unit tests are failing for #3230

@acarbonetto
Copy link
Collaborator

Have found fix for #3225. However, in finding the fix have identified inconsistency of behaviour between extract and yearweek implementation. Specifically, extract is calculating week_of_year using java.time libaray (setting Local to Local.English) where as extract using CalendarLookup.getWeekNumber (to align with MySQL). Depending on which function users use, they will get a different value.

This as a separate bug with reference to the work here. Aligning implementation for extract and extract can be out of scope for this issue and can be solved separately.

Will raise a BUG and get this moving forward as it is blocking further development.

YANG-DB
YANG-DB previously approved these changes Jan 14, 2025
YANG-DB
YANG-DB previously approved these changes Jan 14, 2025
Signed-off-by: Andrew Carbonetto <[email protected]>
Copy link
Collaborator

@noCharger noCharger left a comment

Choose a reason for hiding this comment

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

CI failed on BWC, doesn't seem related though

Execution failed for task ':integ-test:sqlBwcCluster#mixedClusterTask'.
> `cluster{:integ-test:sqlBwcCluster0}` failed to wait for cluster health yellow after 40 SECONDS
    IO error while waiting cluster
    503 Service Unavailable

@acarbonetto
Copy link
Collaborator

CI failed on BWC, doesn't seem related though

Execution failed for task ':integ-test:sqlBwcCluster#mixedClusterTask'.
> `cluster{:integ-test:sqlBwcCluster0}` failed to wait for cluster health yellow after 40 SECONDS
    IO error while waiting cluster
    503 Service Unavailable

No it is not. See: #3184

@acarbonetto acarbonetto merged commit e7be8ca into opensearch-project:main Jan 15, 2025
14 of 15 checks passed
@acarbonetto acarbonetto deleted the bug/flaky-datetime-tests branch January 15, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants