Skip to content

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

Closed

Description

@dai-chen

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

Activity

  1. added
    bug
    on Oct 31, 2022
  2. changed the title [-][BUG] UnixTimeStampTest may fail due to floating precision[/-] [+][BUG] UnixTimeStampTest may fail due to floating point precision[/+] on Oct 31, 2022
  3. Yury-Fridlyand commented on Oct 31, 2022

    @Yury-Fridlyand
    Collaborator

    Depends on #937/#960 as well.

  4. added
    infrastructure
    on Dec 14, 2022
  5. qianheng-aws commented on Apr 7, 2026

    @qianheng-aws
    Collaborator

    Closed as too stale. Didn't see this flakey failure for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginfrastructure

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions