Ryan Skraba created FLINK-35276:
-----------------------------------
Summary: SortCodeGeneratorTest.testMultiKeys fails on negative zero
Key: FLINK-35276
URL: https://issues.apache.org/jira/browse/FLINK-35276
Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 1.20.0, 1.19.1
Reporter: Ryan Skraba
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.
{code:java}
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)
{code}
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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)