#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" #include #if USE_EMBEDDED_COMPILER # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wunused-parameter" # include # pragma GCC diagnostic pop #endif namespace DB { namespace ErrorCodes { extern const int ILLEGAL_TYPE_OF_ARGUMENT; extern const int LOGICAL_ERROR; } template struct UnaryOperationImpl { using ResultType = typename Op::ResultType; using ColVecA = ColumnVectorOrDecimal; using ColVecC = ColumnVectorOrDecimal; using ArrayA = typename ColVecA::Container; using ArrayC = typename ColVecC::Container; MULTITARGET_FUNCTION_AVX2_SSE42( MULTITARGET_FUNCTION_HEADER(static void NO_INLINE), vectorImpl, MULTITARGET_FUNCTION_BODY((const ArrayA & a, ArrayC & c) /// NOLINT { size_t size = a.size(); for (size_t i = 0; i < size; ++i) c[i] = Op::apply(a[i]); })) static void NO_INLINE vector(const ArrayA & a, ArrayC & c) { #if USE_MULTITARGET_CODE if (isArchSupported(TargetArch::AVX2)) { vectorImplAVX2(a, c); return; } else if (isArchSupported(TargetArch::SSE42)) { vectorImplSSE42(a, c); return; } #endif vectorImpl(a, c); } static void constant(A a, ResultType & c) { c = Op::apply(a); } }; template struct FixedStringUnaryOperationImpl { MULTITARGET_FUNCTION_AVX2_SSE42( MULTITARGET_FUNCTION_HEADER(static void NO_INLINE), vectorImpl, MULTITARGET_FUNCTION_BODY((const ColumnFixedString::Chars & a, /// NOLINT ColumnFixedString::Chars & c) { size_t size = a.size(); for (size_t i = 0; i < size; ++i) c[i] = Op::apply(a[i]); })) static void NO_INLINE vector(const ColumnFixedString::Chars & a, ColumnFixedString::Chars & c) { #if USE_MULTITARGET_CODE if (isArchSupported(TargetArch::AVX2)) { vectorImplAVX2(a, c); return; } else if (isArchSupported(TargetArch::SSE42)) { vectorImplSSE42(a, c); return; } #endif vectorImpl(a, c); } }; template struct FunctionUnaryArithmeticMonotonicity; /// Used to indicate undefined operation struct InvalidType; template