Files
scylladb/cql3
Nadav Har'El 81e0f5b581 cql3: allow SUM() aggregation to result in a NaN
When floating-point data contains +Inf and -Inf, the sum is NaN.

Our SUM() aggregation calculated this sum correctly, but then instead
of returning it, complained that the sum overflowed by narrowing.
This was a false positive: The sum() finalizer wanted to test that no
precision was lost when casting the accumulator to the result type,
so checked that the result before and after the cast are the same.
But specifically for NaN, it is never equal to anything - not even
to itself. This check is wrong for floating point, but moreover -
isn't even necessary when the two types (accumulator type and result
type) are identical so in this patch we skip it in this case.

Note that in the current code, a different accumulator and result type
is only used in the case of integer types; When accumulating floating
point sums, the same type is used, so the broken check will be avoided.

The test for this issue starts to pass with this patch, so the xfail
tag is removed.

Fixes #13551

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2023-04-19 09:31:41 +03:00
..
2023-02-28 22:26:43 +02:00
2023-02-15 11:01:50 +02:00
2023-02-14 11:19:03 +02:00
2023-04-06 09:50:32 -04:00
2023-01-18 10:38:24 +02:00
2023-02-15 11:09:04 +02:00
2023-01-18 10:38:24 +02:00
2023-02-15 11:09:04 +02:00
2023-01-30 21:50:23 +08:00
2023-02-15 11:09:04 +02:00
2023-02-19 21:05:45 +02:00