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

Fix locale for monthName/dayName function #2685

Closed

Conversation

bugmakerrrrrr
Copy link
Contributor

@bugmakerrrrrr bugmakerrrrrr commented May 18, 2024

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

#2844

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.

@bugmakerrrrrr
Copy link
Contributor Author

@LantaoJin Would you mind taking a look at this when you have a moment?

@LantaoJin
Copy link
Member

LantaoJin commented Jul 18, 2024

@bugmakerrrrrr could u open an issue to discuss? I'm not sure we must fix it. Considering i18n case, perhaps what we need is adding following code in failed IT or just set your env.

    Properties props = GetPropertyAction.privilegedGetProperties();
    props.setProperty("user.language", "en");

@opensearch-trigger-bot
Copy link
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@anasalkouz
Copy link
Member

Closing this for now, please feel to re-open if needed.

@anasalkouz anasalkouz closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants