From 4a6c25e65d9cec64428db4a067be9171fdef2d3e Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 19 Dec 2018 04:30:32 +0300 Subject: [PATCH] Merging #3721; Added a test --- .../0_stateless/00805_round_down.reference | 53 +++++++++++++++++++ .../queries/0_stateless/00805_round_down.sql | 14 +++++ 2 files changed, 67 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00805_round_down.reference create mode 100644 dbms/tests/queries/0_stateless/00805_round_down.sql diff --git a/dbms/tests/queries/0_stateless/00805_round_down.reference b/dbms/tests/queries/0_stateless/00805_round_down.reference new file mode 100644 index 00000000000..7cd6dc5b00c --- /dev/null +++ b/dbms/tests/queries/0_stateless/00805_round_down.reference @@ -0,0 +1,53 @@ +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 5 +7 5 +8 5 +9 5 +0 -1.5 +1 -1.5 +2 -1.5 +3 2.718281828459045 +4 3.141592653589793 +5 3.141592653589793 +6 5.5 +7 5.5 +8 5.5 +9 5.5 +0 2.718281828459045 +1 2.718281828459045 +2 2.718281828459045 +3 2.718281828459045 +4 3.141592653589793 +5 3.141592653589793 +6 3.141592653589793 +7 3.141592653589793 +8 3.141592653589793 +9 3.141592653589793 +0 4 +1 4 +2 4 +3 4 +4 4 +5 5 +6 6 +7 6 +8 6 +9 6 +1 4 +1 1 +1 1.5 +0 0 +1 0 +2 1.25 +3 2.5 +4 3.75 +5 5 +6 5 +7 6.25 +8 7.5 +9 8.75 diff --git a/dbms/tests/queries/0_stateless/00805_round_down.sql b/dbms/tests/queries/0_stateless/00805_round_down.sql new file mode 100644 index 00000000000..bfd0843a7cb --- /dev/null +++ b/dbms/tests/queries/0_stateless/00805_round_down.sql @@ -0,0 +1,14 @@ +SELECT number as x, roundDown(x, [0, 1, 2, 3, 4, 5]) FROM system.numbers LIMIT 10; +SELECT toUInt8(number) as x, roundDown(x, [-1.5, e(), pi(), 5.5]) FROM system.numbers LIMIT 10; +SELECT toInt32(number) as x, roundDown(x, [e(), pi(), pi(), e()]) FROM system.numbers LIMIT 10; +SELECT number as x, roundDown(x, [6, 5, 4]) FROM system.numbers LIMIT 10; +SELECT 1 as x, roundDown(x, [6, 5, 4]); + +SET send_logs_level = 'none'; +SELECT 1 as x, roundDown(x, []); -- { serverError 43 } +SELECT 1 as x, roundDown(x, emptyArrayUInt8()); -- { serverError 44 } + +SELECT 1 as x, roundDown(x, [1]); +SELECT 1 as x, roundDown(x, [1.5]); + +SELECT number % 10 as x, roundDown(x, (SELECT groupArray(number * 1.25) FROM numbers(100000))) FROM system.numbers LIMIT 10;