facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.2k stars 1.06k forks source link

Geometric_mean doesnt match Presto when run with WindowFuzzer for larger floating point values #9813

Open kgpai opened 2 weeks ago

kgpai commented 2 weeks ago

Bug description

This PR added support for larger floats/doubles : https://github.com/facebookincubator/velox/pull/9747 . This caused geometric mean to fail giving different results compared to that in Presto.

System information

Logs: https://github.com/facebookincubator/velox/pull/9747/files

Relevant logs

I20240514 15:49:39.192898   647 WindowFuzzer.cpp:212] ==============================> Started iteration 684 (seed: 1953296047)
I20240514 15:49:39.387131   647 AggregationFuzzerBase.cpp:395] Executing query plan: 
-- Window[1][partition by [p0] order by [s0 ASC NULLS FIRST, s1 ASC NULLS LAST, s2 DESC NULLS LAST] w0 := geometric_mean(ROW["c0"]) RANGE between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING] -> c0:REAL, s0:VARCHAR, s1:ROW<f0:REAL,f1:BOOLEAN,f2:REAL,f3:BIGINT,f4:VARBINARY,f5:INTEGER>, s2:SMALLINT, p0:TINYINT, row_number:BIGINT, w0:REAL
  -- Values[0][1000 rows in 10 vectors] -> c0:REAL, s0:VARCHAR, s1:ROW<f0:REAL,f1:BOOLEAN,f2:REAL,f3:BIGINT,f4:VARBINARY,f5:INTEGER>, s2:SMALLINT, p0:TINYINT, row_number:BIGINT
I20240514 15:49:39.408535  8325 Task.cpp:1134] All drivers (1) finished for task test_cursor 2703 after running for 21 ms.
I20240514 15:49:39.408558  8325 Task.cpp:1870] Terminating task test_cursor 2703 with state Finished after running for 21 ms.
I20240514 15:49:39.564172   647 FileSink.cpp:125] closing file: /opt/presto-server/etc/data/tpch/tmp/fuzzer.dwrf,  total size: 1.30MB
/__w/velox/velox/velox/velox/exec/tests/utils/QueryAssertions.cpp:1125: Failure
Failed
Expected 1000, got 1000
214 extra rows, 214 missing rows
10 of extra rows:
    1073573888 | null | null | null | 77 | 623 | 766573952
    424631872 | null | null | null | 127 | 647 | 151252224
    581029376 | null | null | 11002 | 105 | 605 | 487219424
    97190992 | null | null | 11136 | 4 | 631 | 133959720
    258992864 | null | null | 23494 | 121 | 604 | 310637216
    1483148672 | null | null | 32283 | 4 | 762 | 133959720

10 of missing rows:
    1073573888 | null | null | null | 77 | 623 | 766574144
    424631872 | null | null | null | 127 | 647 | 151252176
    581029376 | null | null | 11002 | 105 | 605 | 487219584
    97190992 | null | null | 11136 | 4 | 631 | 133959688
    258992864 | null | null | 23494 | 121 | 604 | 310637312
    1483148672 | null | null | 32283 | 4 | 762 | 133959688
    730609408 | null |