From 75f1d7b8200eb936af4a68171eb6ee9ac394b9ee Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 9 Mar 2017 23:40:36 +0300 Subject: [PATCH] Added test [#CLICKHOUSE-2789]. --- .../0_stateless/00435_coalesce.reference | 46 +++++++++++++++++++ .../queries/0_stateless/00435_coalesce.sql | 6 +++ 2 files changed, 52 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00435_coalesce.reference create mode 100644 dbms/tests/queries/0_stateless/00435_coalesce.sql diff --git a/dbms/tests/queries/0_stateless/00435_coalesce.reference b/dbms/tests/queries/0_stateless/00435_coalesce.reference new file mode 100644 index 00000000000..20b8288b09c --- /dev/null +++ b/dbms/tests/queries/0_stateless/00435_coalesce.reference @@ -0,0 +1,46 @@ +\N \N \N 1 1 1 1 +0 Nullable(UInt64) +\N Nullable(UInt64) +2 Nullable(UInt64) +3 Nullable(UInt64) +4 Nullable(UInt64) +5 Nullable(UInt64) +6 Nullable(UInt64) +\N Nullable(UInt64) +8 Nullable(UInt64) +9 Nullable(UInt64) +10 Nullable(UInt64) +\N Nullable(UInt64) +12 Nullable(UInt64) +\N Nullable(UInt64) +14 Nullable(UInt64) +0 UInt64 +1 UInt64 +2 UInt64 +3 UInt64 +4 UInt64 +5 UInt64 +6 UInt64 +7 UInt64 +8 UInt64 +9 UInt64 +10 UInt64 +11 UInt64 +12 UInt64 +13 UInt64 +14 UInt64 +0 UInt64 +100 UInt64 +2 UInt64 +3 UInt64 +4 UInt64 +100 UInt64 +6 UInt64 +100 UInt64 +8 UInt64 +9 UInt64 +10 UInt64 +100 UInt64 +12 UInt64 +100 UInt64 +14 UInt64 diff --git a/dbms/tests/queries/0_stateless/00435_coalesce.sql b/dbms/tests/queries/0_stateless/00435_coalesce.sql new file mode 100644 index 00000000000..7c1c519bcb2 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00435_coalesce.sql @@ -0,0 +1,6 @@ +SELECT coalesce(), coalesce(NULL), coalesce(NULL, NULL), + coalesce(1), coalesce(1, NULL), coalesce(NULL, 1), coalesce(NULL, 1, NULL); + +SELECT coalesce(number % 2 = 0 ? number : NULL, number % 3 = 0 ? number : NULL, number % 5 = 0 ? number : NULL) AS res, toTypeName(res) FROM system.numbers LIMIT 15; +SELECT coalesce(number % 2 = 0 ? number : NULL, number % 3 = 0 ? number : NULL, number) AS res, toTypeName(res) FROM system.numbers LIMIT 15; +SELECT coalesce(number % 2 = 0 ? number : NULL, number % 3 = 0 ? number : NULL, 100) AS res, toTypeName(res) FROM system.numbers LIMIT 15;