sql icon indicating copy to clipboard operation
sql copied to clipboard

Fix locale for monthName/dayName function

Open bugmakerrrrrr opened this issue 9 months ago • 0 comments

Description

The monthName/dayName function uses Locale.getDefault to get the display name, which may return different results in different env and cause a test error.

org.opensearch.sql.sql.DateTimeFunctionIT > testMonthName FAILED
    java.lang.AssertionError: 
    Expected: iterable with items [[September]] in any order
         but: not matched: <["九月"]>
        at __randomizedtesting.SeedInfo.seed([3027A175091234F:5336A188EBBE09E2]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
        at org.opensearch.sql.util.MatcherUtils.verify(MatcherUtils.java:173)
        at org.opensearch.sql.util.MatcherUtils.verifyDataRows(MatcherUtils.java:149)
        at org.opensearch.sql.sql.DateTimeFunctionIT.testMonthName(DateTimeFunctionIT.java:801)

Issues Resolved

[List any issues this PR will resolve]

Check List

  • [x] New functionality includes testing.
    • [x] All tests pass, including unit test, integration test and doctest
  • [x] New functionality has been documented.
    • [x] New functionality has javadoc added
    • [x] New functionality has user manual doc added
  • [x] 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.

bugmakerrrrrr avatar May 18 '24 16:05 bugmakerrrrrr