mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Add a test
This commit is contained in:
parent
960d149e0b
commit
056b44b64f
@ -12,10 +12,10 @@
|
||||
|
||||
namespace DB
|
||||
{
|
||||
template <class T>
|
||||
template <typename T>
|
||||
using DecimalOrVectorCol = std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<T>, ColumnVector<T>>;
|
||||
|
||||
template <class T> constexpr bool DecimalOrExtendedInt =
|
||||
template <typename T> constexpr bool DecimalOrExtendedInt =
|
||||
IsDecimalNumber<T>
|
||||
|| std::is_same_v<T, Int128>
|
||||
|| std::is_same_v<T, Int256>
|
||||
@ -25,7 +25,7 @@ template <class T> constexpr bool DecimalOrExtendedInt =
|
||||
/**
|
||||
* Helper class to encapsulate values conversion for avg and avgWeighted.
|
||||
*/
|
||||
template <class Numerator, class Denominator>
|
||||
template <typename Numerator, typename Denominator>
|
||||
struct AvgFraction
|
||||
{
|
||||
Numerator numerator{0};
|
||||
@ -84,7 +84,7 @@ struct AvgFraction
|
||||
* @tparam Derived When deriving from this class, use the child class name as in CRTP, e.g.
|
||||
* class Self : Agg<char, bool, bool, Self>.
|
||||
*/
|
||||
template <class Numerator, class Denominator, class Derived>
|
||||
template <typename Numerator, typename Denominator, typename Derived>
|
||||
class AggregateFunctionAvgBase : public
|
||||
IAggregateFunctionDataHelper<AvgFraction<Numerator, Denominator>, Derived>
|
||||
{
|
||||
|
@ -1 +1,5 @@
|
||||
4233720368547758080
|
||||
384883669867978000
|
||||
4233720368547758080
|
||||
384883669867978000
|
||||
-88000000000000000000
|
||||
|
@ -1,3 +1,9 @@
|
||||
-- Aggregate function 'sum' allows overflow with two's complement arithmetics.
|
||||
-- This contradicts the standard SQL semantic and we are totally fine with it.
|
||||
SELECT sum(-8000000000000000000) FROM numbers(11);
|
||||
SELECT avg(-8000000000000000000) FROM numbers(11);
|
||||
|
||||
SELECT sum(-8000000000000000000) FROM remote('127.0.0.{1,2,3,4,5,6,7,8,9,10,11}', system.one);
|
||||
SELECT avg(-8000000000000000000) FROM remote('127.0.0.{1,2,3,4,5,6,7,8,9,10,11}', system.one);
|
||||
|
||||
SELECT sumKahan(-8000000000000000000) FROM numbers(11);
|
||||
|
Loading…
Reference in New Issue
Block a user