[refactor](decimalv3) Refine code for DecimalV3 (#14394)

This commit is contained in:
Gabriel
2022-11-19 16:57:17 +08:00
committed by GitHub
parent 1482ab32b6
commit 2c42f0a905
108 changed files with 1123 additions and 707 deletions

View File

@ -55,20 +55,27 @@ struct ArrayAggregateResultImpl<Element, AggregateOperation::MAX> {
template <typename Element>
struct ArrayAggregateResultImpl<Element, AggregateOperation::AVERAGE> {
using Result = std::conditional_t<IsDecimalNumber<Element>, Decimal128, Float64>;
using Result =
std::conditional_t<IsDecimalV2<Element>, Decimal128,
std::conditional_t<IsDecimalNumber<Element>, Decimal128I, Float64>>;
};
template <typename Element>
struct ArrayAggregateResultImpl<Element, AggregateOperation::PRODUCT> {
using Result = std::conditional_t<IsDecimalNumber<Element>, Decimal128, Float64>;
using Result =
std::conditional_t<IsDecimalV2<Element>, Decimal128,
std::conditional_t<IsDecimalNumber<Element>, Decimal128I, Float64>>;
};
template <typename Element>
struct ArrayAggregateResultImpl<Element, AggregateOperation::SUM> {
using Result = std::conditional_t<
IsDecimalNumber<Element>, Decimal128,
std::conditional_t<IsFloatNumber<Element>, Float64,
std::conditional_t<std::is_same_v<Element, Int128>, Int128, Int64>>>;
IsDecimalV2<Element>, Decimal128,
std::conditional_t<
IsDecimalNumber<Element>, Decimal128I,
std::conditional_t<
IsFloatNumber<Element>, Float64,
std::conditional_t<std::is_same_v<Element, Int128>, Int128, Int64>>>>;
};
template <typename Element, AggregateOperation operation>
@ -168,6 +175,7 @@ struct ArrayAggregateImpl {
execute_type<Float32>(res, type, data, offsets) ||
execute_type<Float64>(res, type, data, offsets) ||
execute_type<Decimal128>(res, type, data, offsets) ||
execute_type<Decimal128I>(res, type, data, offsets) ||
execute_type<Date>(res, type, data, offsets) ||
execute_type<DateTime>(res, type, data, offsets) ||
execute_type<DateV2>(res, type, data, offsets) ||