From 6debaccd85c34a7e777f5bd9241abf4e09490540 Mon Sep 17 00:00:00 2001 From: Nikolay Degterinsky Date: Sun, 9 Apr 2023 11:12:08 +0000 Subject: [PATCH] Fix build --- src/DataTypes/DataTypeDateTime64.cpp | 4 +-- src/DataTypes/DataTypeDateTime64.h | 2 +- src/Functions/array/arrayAggregation.cpp | 44 +++++++++++++----------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/DataTypes/DataTypeDateTime64.cpp b/src/DataTypes/DataTypeDateTime64.cpp index 248eb3638b9..124fea1f458 100644 --- a/src/DataTypes/DataTypeDateTime64.cpp +++ b/src/DataTypes/DataTypeDateTime64.cpp @@ -57,14 +57,14 @@ SerializationPtr DataTypeDateTime64::doGetDefaultSerialization() const return std::make_shared(scale, *this); } -inline std::string getDateTimeTimezone(const IDataType & data_type) +std::string getDateTimeTimezone(const IDataType & data_type) { if (const auto * type = typeid_cast(&data_type)) return type->hasExplicitTimeZone() ? type->getTimeZone().getTimeZone() : std::string(); if (const auto * type = typeid_cast(&data_type)) return type->hasExplicitTimeZone() ? type->getTimeZone().getTimeZone() : std::string(); - throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot get decimal scale from type {}", data_type.getName()); + throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot get time zone from type {}", data_type.getName()); } } diff --git a/src/DataTypes/DataTypeDateTime64.h b/src/DataTypes/DataTypeDateTime64.h index 64547b30be9..aaa99485040 100644 --- a/src/DataTypes/DataTypeDateTime64.h +++ b/src/DataTypes/DataTypeDateTime64.h @@ -41,7 +41,7 @@ protected: SerializationPtr doGetDefaultSerialization() const override; }; -inline std::string getDateTimeTimezone(const IDataType & data_type); +std::string getDateTimeTimezone(const IDataType & data_type); } diff --git a/src/Functions/array/arrayAggregation.cpp b/src/Functions/array/arrayAggregation.cpp index 1fe02870e4d..e13b5b1d2f1 100644 --- a/src/Functions/array/arrayAggregation.cpp +++ b/src/Functions/array/arrayAggregation.cpp @@ -84,9 +84,10 @@ struct ArrayAggregateResultImpl std::conditional_t, Decimal128, std::conditional_t, Decimal128, std::conditional_t, Decimal256, + std::conditional_t, Decimal128, std::conditional_t, Float64, std::conditional_t, Int64, - UInt64>>>>>>>>>>; + UInt64>>>>>>>>>>>; }; template @@ -111,28 +112,31 @@ struct ArrayAggregateImpl using Types = std::decay_t; using DataType = typename Types::LeftType; - if constexpr (aggregate_operation == AggregateOperation::average || aggregate_operation == AggregateOperation::product) + if constexpr (!IsDataTypeDateOrDateTime) { - result = std::make_shared(); + if constexpr (aggregate_operation == AggregateOperation::average || aggregate_operation == AggregateOperation::product) + { + result = std::make_shared(); - return true; - } - else if constexpr (IsDataTypeNumber) - { - using NumberReturnType = ArrayAggregateResult; - result = std::make_shared>(); + return true; + } + else if constexpr (IsDataTypeNumber) + { + using NumberReturnType = ArrayAggregateResult; + result = std::make_shared>(); - return true; - } - else if constexpr (IsDataTypeDecimal && !IsDataTypeDateOrDateTime) - { - using DecimalReturnType = ArrayAggregateResult; - UInt32 scale = getDecimalScale(*expression_return); - result = std::make_shared>(DecimalUtils::max_precision, scale); + return true; + } + else if constexpr (IsDataTypeDecimal) + { + using DecimalReturnType = ArrayAggregateResult; + UInt32 scale = getDecimalScale(*expression_return); + result = std::make_shared>(DecimalUtils::max_precision, scale); - return true; + return true; + } } - else if constexpr (IsDataTypeDateOrDateTime && (aggregate_operation == AggregateOperation::max || aggregate_operation == AggregateOperation::min)) + else if constexpr (aggregate_operation == AggregateOperation::max || aggregate_operation == AggregateOperation::min) { if constexpr (IsDataTypeDate) { @@ -143,7 +147,7 @@ struct ArrayAggregateImpl else if constexpr (!IsDataTypeDecimal) { std::string timezone = getDateTimeTimezone(*expression_return); - result = std::make_shared(timezone); + result = std::make_shared(timezone); return true; } @@ -151,7 +155,7 @@ struct ArrayAggregateImpl { std::string timezone = getDateTimeTimezone(*expression_return); UInt32 scale = getDecimalScale(*expression_return); - result = std::make_shared(scale, timezone); + result = std::make_shared(scale, timezone); return true; }