summaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/least.cpp
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-01-04 15:09:05 +0100
committerGitHub <[email protected]>2024-01-04 15:09:05 +0100
commitdab291146f6cd7d35684e3a1150e5bb1c412982c (patch)
tree36ef35f6cacb6432845a4a33f940c95871036b32 /contrib/clickhouse/src/Functions/least.cpp
parent63660ad5e7512029fd0218e7a636580695a24e1f (diff)
Library import 5, delete go dependencies (#832)
* Library import 5, delete go dependencies * Fix yt client
Diffstat (limited to 'contrib/clickhouse/src/Functions/least.cpp')
-rw-r--r--contrib/clickhouse/src/Functions/least.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/contrib/clickhouse/src/Functions/least.cpp b/contrib/clickhouse/src/Functions/least.cpp
deleted file mode 100644
index f5680d4d468..00000000000
--- a/contrib/clickhouse/src/Functions/least.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <Functions/FunctionFactory.h>
-#include <Functions/FunctionBinaryArithmetic.h>
-#include <Core/AccurateComparison.h>
-#include <Functions/LeastGreatestGeneric.h>
-
-
-namespace DB
-{
-
-template <typename A, typename B>
-struct LeastBaseImpl
-{
- using ResultType = NumberTraits::ResultOfLeast<A, B>;
- static const constexpr bool allow_fixed_string = false;
- static const constexpr bool allow_string_integer = false;
-
- template <typename Result = ResultType>
- static inline Result apply(A a, B b)
- {
- /** gcc 4.9.2 successfully vectorizes a loop from this function. */
- return static_cast<Result>(a) < static_cast<Result>(b) ? static_cast<Result>(a) : static_cast<Result>(b);
- }
-
-#if USE_EMBEDDED_COMPILER
- static constexpr bool compilable = true;
-
- static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool is_signed)
- {
- if (!left->getType()->isIntegerTy())
- {
- /// Follows the IEEE-754 semantics for minNum, except for handling of signaling NaNs. This match’s the behavior of libc fmin.
- return b.CreateMinNum(left, right);
- }
-
- auto * compare_value = is_signed ? b.CreateICmpSLT(left, right) : b.CreateICmpULT(left, right);
- return b.CreateSelect(compare_value, left, right);
- }
-#endif
-};
-
-template <typename A, typename B>
-struct LeastSpecialImpl
-{
- using ResultType = std::make_signed_t<A>;
- static const constexpr bool allow_fixed_string = false;
- static const constexpr bool allow_string_integer = false;
-
- template <typename Result = ResultType>
- static inline Result apply(A a, B b)
- {
- static_assert(std::is_same_v<Result, ResultType>, "ResultType != Result");
- return accurate::lessOp(a, b) ? static_cast<Result>(a) : static_cast<Result>(b);
- }
-
-#if USE_EMBEDDED_COMPILER
- static constexpr bool compilable = false; /// ???
-#endif
-};
-
-template <typename A, typename B>
-using LeastImpl = std::conditional_t<!NumberTraits::LeastGreatestSpecialCase<A, B>, LeastBaseImpl<A, B>, LeastSpecialImpl<A, B>>;
-
-struct NameLeast { static constexpr auto name = "least"; };
-using FunctionLeast = FunctionBinaryArithmetic<LeastImpl, NameLeast>;
-
-REGISTER_FUNCTION(Least)
-{
- factory.registerFunction<LeastGreatestOverloadResolver<LeastGreatest::Least, FunctionLeast>>({}, FunctionFactory::CaseInsensitive);
-}
-
-}