From e5a33e63327f8c7c23e039cfe7fdbd2df9533c0e Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 23 Dec 2017 05:52:13 +0300 Subject: [PATCH] Added test for the case when Nullable condition is optimized to PREWHERE #1626 --- .../00543_null_and_prewhere.reference | 1 + .../0_stateless/00543_null_and_prewhere.sql | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00543_null_and_prewhere.reference create mode 100644 dbms/tests/queries/0_stateless/00543_null_and_prewhere.sql diff --git a/dbms/tests/queries/0_stateless/00543_null_and_prewhere.reference b/dbms/tests/queries/0_stateless/00543_null_and_prewhere.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00543_null_and_prewhere.reference @@ -0,0 +1 @@ +1 diff --git a/dbms/tests/queries/0_stateless/00543_null_and_prewhere.sql b/dbms/tests/queries/0_stateless/00543_null_and_prewhere.sql new file mode 100644 index 00000000000..063280085c3 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00543_null_and_prewhere.sql @@ -0,0 +1,17 @@ +CREATE TABLE test.test +( + dt Date, + id UInt32, + val Nullable(UInt32) +) +ENGINE = MergeTree(dt, id, 8192); + +insert into test.test (dt, id, val) values ('2017-01-01', 1, 10); +insert into test.test (dt, id, val) values ('2017-01-01', 1, null); +insert into test.test (dt, id, val) values ('2017-01-01', 1, 0); + +SELECT count() +FROM test.test +WHERE val = 0; + +DROP TABLE IF EXISTS test.test;