-
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 <kenrick.yap@improving.com>
@@ -1232,26 +1234,37 @@ public void testWeekFormats( | |||
// Issue: https://github.com/opensearch-project/sql/issues/2477 | |||
@Test | |||
public void testWeekOfYearWithTimeType() { | |||
// The following calculation is needed to correct the discrepancy in how ISO 8601 |
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.
Can we move this logic to a common test util class to avoid duplication?
Unfortunately, neither YearweekTest
nor DateTimeFunctionTest
extends DateTimeTestBase
. But I think that might be a good place to move the function (maybe as a static method?) unless you can find a better place.
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.
addressed comment
Signed-off-by: Kenrick Yap <kenrick.yap@improving.com>
@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! |
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.