-
Notifications
You must be signed in to change notification settings - Fork 141
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
base: main
Are you sure you want to change the base?
Conversation
…t.testYearWeekWithTimeType test failures Signed-off-by: Kenrick Yap <[email protected]>
core/src/test/java/org/opensearch/sql/expression/datetime/DateTimeFunctionTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Kenrick Yap <[email protected]>
@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! |
// - 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. | ||
protected static int getYearWeek(LocalDate date) { |
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.
why protected?
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.
any update?
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:
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
--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.