From 526b33f607d4875ea8b0b3b725dd64e0cc8b73d7 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 3 Feb 2019 11:49:49 +0300 Subject: [PATCH] Added a test --- .../00835_if_generic_case.reference | 17 +++++++++++++++++ .../0_stateless/00835_if_generic_case.sql | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00835_if_generic_case.reference create mode 100644 dbms/tests/queries/0_stateless/00835_if_generic_case.sql diff --git a/dbms/tests/queries/0_stateless/00835_if_generic_case.reference b/dbms/tests/queries/0_stateless/00835_if_generic_case.reference new file mode 100644 index 00000000000..45ee4651e17 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00835_if_generic_case.reference @@ -0,0 +1,17 @@ +2000-01-01 00:00:00 2000-01-02 2000-01-02 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-02 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-02 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-02 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-02 +2000-01-01 00:00:00 2000-01-02 2000-01-02 +2000-01-01 00:00:00 2000-01-02 2000-01-02 +2000-01-01 00:00:00 2000-01-02 2000-01-02 +2000-01-01 00:00:00 2000-01-02 2000-01-01 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-01 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-01 00:00:00 +2000-01-01 00:00:00 2000-01-02 2000-01-01 00:00:00 +0 +1 +2 +3 +4 diff --git a/dbms/tests/queries/0_stateless/00835_if_generic_case.sql b/dbms/tests/queries/0_stateless/00835_if_generic_case.sql new file mode 100644 index 00000000000..011cea46ffc --- /dev/null +++ b/dbms/tests/queries/0_stateless/00835_if_generic_case.sql @@ -0,0 +1,18 @@ +SELECT toDateTime('2000-01-01 00:00:00', 'Europe/Moscow') AS x, toDate('2000-01-02') AS y, x > y ? x : y AS z; +SELECT materialize(toDateTime('2000-01-01 00:00:00', 'Europe/Moscow')) AS x, toDate('2000-01-02') AS y, x > y ? x : y AS z; +SELECT toDateTime('2000-01-01 00:00:00', 'Europe/Moscow') AS x, materialize(toDate('2000-01-02')) AS y, x > y ? x : y AS z; +SELECT materialize(toDateTime('2000-01-01 00:00:00', 'Europe/Moscow')) AS x, materialize(toDate('2000-01-02')) AS y, x > y ? x : y AS z; + +SELECT toDateTime('2000-01-01 00:00:00', 'Europe/Moscow') AS x, toDate('2000-01-02') AS y, 0 ? x : y AS z; +SELECT materialize(toDateTime('2000-01-01 00:00:00', 'Europe/Moscow')) AS x, toDate('2000-01-02') AS y, 0 ? x : y AS z; +SELECT toDateTime('2000-01-01 00:00:00', 'Europe/Moscow') AS x, materialize(toDate('2000-01-02')) AS y, 0 ? x : y AS z; +SELECT materialize(toDateTime('2000-01-01 00:00:00', 'Europe/Moscow')) AS x, materialize(toDate('2000-01-02')) AS y, 0 ? x : y AS z; + +SELECT toDateTime('2000-01-01 00:00:00', 'Europe/Moscow') AS x, toDate('2000-01-02') AS y, 1 ? x : y AS z; +SELECT materialize(toDateTime('2000-01-01 00:00:00', 'Europe/Moscow')) AS x, toDate('2000-01-02') AS y, 1 ? x : y AS z; +SELECT toDateTime('2000-01-01 00:00:00', 'Europe/Moscow') AS x, materialize(toDate('2000-01-02')) AS y, 1 ? x : y AS z; +SELECT materialize(toDateTime('2000-01-01 00:00:00', 'Europe/Moscow')) AS x, materialize(toDate('2000-01-02')) AS y, 1 ? x : y AS z; + +SELECT rand() % 2 = 0 ? number : number FROM numbers(5); + +SELECT rand() % 2 = 0 ? number : toString(number) FROM numbers(5); -- { serverError 386 }