2021-12-10 18:51:43 +00:00
|
|
|
-- { echo }
|
|
|
|
|
|
|
|
-- Aggregate function 'avg' allows overflow with two's complement arithmetics.
|
|
|
|
-- This contradicts the standard SQL semantic and we are totally fine with it.
|
2021-12-10 18:51:43 +00:00
|
|
|
|
|
|
|
-- AggregateFunctionAvg::add
|
|
|
|
SELECT avg(-8000000000000000000) FROM (SELECT *, 1 AS k FROM numbers(65535*2)) GROUP BY k;
|
|
|
|
63121857572613.94
|
|
|
|
-- AggregateFunctionAvg::addBatchSinglePlace
|
|
|
|
SELECT avg(-8000000000000000000) FROM numbers(65535 * 2);
|
|
|
|
63121857572613.94
|
|
|
|
-- AggregateFunctionAvg::addBatchSinglePlaceNotNull
|
|
|
|
SELECT avg(toNullable(-8000000000000000000)) FROM numbers(65535 * 2);
|
|
|
|
63121857572613.94
|