#pragma once // Include this first, because `#define _asan_poison_address` from // llvm/Support/Compiler.h conflicts with its forward declaration in // sanitizer/asan_interface.h #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Core/DecimalFunctions.h" #include "IFunction.h" #include "FunctionHelpers.h" #include "IsOperation.h" #include "DivisionUtils.h" #include "castTypeToEither.h" #include "FunctionFactory.h" #include #include #include #include #include #if !defined(ARCADIA_BUILD) # include #endif #if USE_EMBEDDED_COMPILER # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wunused-parameter" # include # pragma GCC diagnostic pop #endif #include namespace DB { namespace ErrorCodes { extern const int ILLEGAL_COLUMN; extern const int ILLEGAL_TYPE_OF_ARGUMENT; extern const int LOGICAL_ERROR; extern const int DECIMAL_OVERFLOW; extern const int CANNOT_ADD_DIFFERENT_AGGREGATE_STATES; extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; } namespace traits_ { struct InvalidType; /// Used to indicate undefined operation template struct Case : std::bool_constant { using type = T; }; /// Switch, ...> -- select the first Ti for which Ci is true, InvalidType if none. template using Switch = typename std::disjunction>::type; template using DataTypeFromFieldType = std::conditional_t, InvalidType, DataTypeNumber>; template constexpr bool IsIntegral = false; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template <> inline constexpr bool IsIntegral = true; template constexpr bool IsExtended = false; template <> inline constexpr bool IsExtended = true; template <> inline constexpr bool IsExtended = true; template <> inline constexpr bool IsExtended = true; template <> inline constexpr bool IsExtended = true; template constexpr bool IsIntegralOrExtended = IsIntegral || IsExtended; template constexpr bool IsIntegralOrExtendedOrDecimal = IsIntegralOrExtended || IsDataTypeDecimal; template constexpr bool IsFloatingPoint = false; template <> inline constexpr bool IsFloatingPoint = true; template <> inline constexpr bool IsFloatingPoint = true; template constexpr bool IsDateOrDateTime = false; template <> inline constexpr bool IsDateOrDateTime = true; template <> inline constexpr bool IsDateOrDateTime = true; template constexpr bool UseLeftDecimal = false; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template