Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-35276

SortCodeGeneratorTest.testMultiKeys fails on negative zero

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 1.20.0, 1.19.1
    • None
    • Table SQL / Planner

    Description

      1.19 AdaptiveScheduler / Test (module: table) https://github.com/apache/flink/actions/runs/8864296211/job/24339523745#step:10:10757

      SortCodeGeneratorTest can fail if one of the generated random row values is -0.0f.

      Apr 28 02:38:03 expect: +I(,SqlRawValue{?},0.0,false); actual: +I(,SqlRawValue{?},-0.0,false)
      Apr 28 02:38:03 expect: +I(,SqlRawValue{?},-0.0,false); actual: +I(,SqlRawValue{?},0.0,false)
      ...
      <snip>
      ...
      Apr 28 02:38:04 expect: +I(,null,4.9695407E17,false); actual: +I(,null,4.9695407E17,false)
      Apr 28 02:38:04 expect: +I(,null,-3.84924672E18,false); actual: +I(,null,-3.84924672E18,false)
      Apr 28 02:38:04 types: [[RAW('java.lang.Integer', ?), FLOAT, BOOLEAN]]
      Apr 28 02:38:04 keys: [0, 1]] 
      Apr 28 02:38:04 expected: 0.0f
      Apr 28 02:38:04  but was: -0.0f
      Apr 28 02:38:04 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      Apr 28 02:38:04 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      Apr 28 02:38:04 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      Apr 28 02:38:04 	at org.apache.flink.table.planner.codegen.SortCodeGeneratorTest.testInner(SortCodeGeneratorTest.java:632)
      Apr 28 02:38:04 	at org.apache.flink.table.planner.codegen.SortCodeGeneratorTest.testMultiKeys(SortCodeGeneratorTest.java:143)
      Apr 28 02:38:04 	at java.lang.reflect.Method.invoke(Method.java:498)
      

      In the test code, this is extremely unlikely to occur (one in 2²⁴?) but has happened at this line (when the rnd.nextFloat() is 0.0f and rnd.nextLong() is negative:

      https://github.com/apache/flink/blob/e7ce0a2969633168b9395c683921aa49362ad7a4/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/codegen/SortCodeGeneratorTest.java#L255

      We can reproduce the failure by changing how likely 0.0f is to be generated at that line.

      Attachments

        1. job-logs.txt
          2.29 MB
          Ryan Skraba

        Activity

          People

            Unassigned Unassigned
            rskraba Ryan Skraba
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: