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

[BUG] UnixTimeStampTest may fail due to floating point precision #996

Open
dai-chen opened this issue Oct 31, 2022 · 1 comment
Open

[BUG] UnixTimeStampTest may fail due to floating point precision #996

dai-chen opened this issue Oct 31, 2022 · 1 comment
Assignees
Labels
bug Something isn't working infrastructure Changes to infrastructure, testing, CI/CD, pipelines, etc.

Comments

@dai-chen
Copy link
Collaborator

dai-chen commented Oct 31, 2022

What is the bug?
UnixTimeStampTest.checkNoArgs() may fail sometimes and floating precision seems the root cause. See error logs below:

UnixTimeStampTest > checkNoArgs() FAILED
    org.opentest4j.AssertionFailedError: expected: <1667255816> but was: <1667255817>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:618)
        at app//org.opensearch.sql.expression.datetime.UnixTimeStampTest.checkNoArgs(UnixTimeStampTest.java:34)

Code:

  @Test
  public void checkNoArgs() {
    assertEquals(System.currentTimeMillis() / 1000L, unixTimeStamp());
    assertEquals(System.currentTimeMillis() / 1000L, eval(unixTimeStampExpr()).longValue());
  }

How can one reproduce the bug?
N/A

What is the expected behavior?
Without nondeterministic behavior, UnixTimeStampTest.checkNoArgs() can pass all the time.

What is your host/environment?

  • Github action failed on 2.x branch

Do you have any screenshots?
N/A

Do you have any additional context?
N/A

@dai-chen dai-chen added the bug Something isn't working label Oct 31, 2022
@dai-chen dai-chen changed the title [BUG] UnixTimeStampTest may fail due to floating precision [BUG] UnixTimeStampTest may fail due to floating point precision Oct 31, 2022
@Yury-Fridlyand Yury-Fridlyand self-assigned this Oct 31, 2022
@Yury-Fridlyand
Copy link
Collaborator

Depends on #937/#960 as well.

@dai-chen dai-chen added the infrastructure Changes to infrastructure, testing, CI/CD, pipelines, etc. label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working infrastructure Changes to infrastructure, testing, CI/CD, pipelines, etc.
Projects
None yet
Development

No branches or pull requests

2 participants