From c6134124f66a6b74131acfb4a8a6442ac08385b7 Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Tue, 2 Dec 2014 20:24:25 +0300 Subject: [PATCH] dbms: remove square function, alter tests. [#METR-13613] --- dbms/include/DB/Functions/FunctionsMath.h | 2 -- dbms/src/Functions/FunctionsMath.cpp | 1 - .../0_stateless/00087_math_functions.reference | 4 ---- .../queries/0_stateless/00087_math_functions.sql | 11 +++-------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dbms/include/DB/Functions/FunctionsMath.h b/dbms/include/DB/Functions/FunctionsMath.h index e74d73f2d28..fe818acbf2a 100644 --- a/dbms/include/DB/Functions/FunctionsMath.h +++ b/dbms/include/DB/Functions/FunctionsMath.h @@ -451,7 +451,6 @@ struct PiImpl static constexpr auto value = 3.1415926535897932384626433832795028841971693; }; -struct SquareName { static constexpr auto name = "square"; }; struct ExpName { static constexpr auto name = "exp"; }; struct LogName { static constexpr auto name = "log"; }; struct Exp2Name { static constexpr auto name = "exp2"; }; @@ -474,7 +473,6 @@ struct PowName { static constexpr auto name = "pow"; }; using FunctionE = FunctionMathNullaryConstFloat64; using FunctionPi = FunctionMathNullaryConstFloat64; -using FunctionSqr = FunctionMathUnaryFloat64>; using FunctionExp = FunctionMathUnaryFloat64>; using FunctionLog = FunctionMathUnaryFloat64>; using FunctionExp2 = FunctionMathUnaryFloat64>; diff --git a/dbms/src/Functions/FunctionsMath.cpp b/dbms/src/Functions/FunctionsMath.cpp index bade70e89bf..0aff7ed996f 100644 --- a/dbms/src/Functions/FunctionsMath.cpp +++ b/dbms/src/Functions/FunctionsMath.cpp @@ -8,7 +8,6 @@ void registerFunctionsMath(FunctionFactory & factory) { factory.registerFunction(); factory.registerFunction(); - factory.registerFunction(); factory.registerFunction(); factory.registerFunction(); factory.registerFunction(); diff --git a/dbms/tests/queries/0_stateless/00087_math_functions.reference b/dbms/tests/queries/0_stateless/00087_math_functions.reference index f018a0a276a..3e709ddfe52 100644 --- a/dbms/tests/queries/0_stateless/00087_math_functions.reference +++ b/dbms/tests/queries/0_stateless/00087_math_functions.reference @@ -72,7 +72,3 @@ 1 1 1 -1 -1 -1 -1 diff --git a/dbms/tests/queries/0_stateless/00087_math_functions.sql b/dbms/tests/queries/0_stateless/00087_math_functions.sql index ad02b5502d3..3a5946105d0 100644 --- a/dbms/tests/queries/0_stateless/00087_math_functions.sql +++ b/dbms/tests/queries/0_stateless/00087_math_functions.sql @@ -8,20 +8,15 @@ select abs(-128) = 128; select abs(127) = 127; select sum(abs(number - 10 as x) = (x < 0 ? -x : x)) / count() array join range(1000000) as number; -select square(0) = 0; -select square(1) = 1; -select square(2) = 4; -select sum(square(x) = x * x) / count() array join range(1000000) as x; - select sqrt(0) = 0; select sqrt(1) = 1; select sqrt(4) = 2; -select sum(sqrt(square(x)) = x) / count() array join range(1000000) as x; +select sum(sqrt(x * x) = x) / count() array join range(1000000) as x; select cbrt(0) = 0; select cbrt(1) = 1; select cbrt(8) = 2; -select sum(abs(cbrt(x * square(x)) - x) < 1.0e-9) / count() array join range(1000000) as x; +select sum(abs(cbrt(x * x * x) - x) < 1.0e-9) / count() array join range(1000000) as x; select pow(1, 0) = 1; select pow(2, 0) = 1; @@ -29,7 +24,7 @@ select sum(pow(x, 0) = 1) / count() array join range(1000000) as x; select pow(1, 1) = 1; select pow(2, 1) = 2; select sum(abs(pow(x, 1) - x) < 1.0e-9) / count() array join range(1000000) as x; -select sum(pow(x, 2) = square(x)) / count() array join range(10000) as x; +select sum(pow(x, 2) = x * x) / count() array join range(10000) as x; select tgamma(0) = inf; select tgamma(1) = 1;