From c6ec4f9ff5677610365482951c2951c9a8a12d71 Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Wed, 16 Sep 2015 18:33:58 +0300 Subject: [PATCH] dbms:: add test for missing column in PREWHERE [#METR-18009] --- .../00229_prewhere_column_missing.reference | 5 +++++ .../0_stateless/00229_prewhere_column_missing.sql | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00229_prewhere_column_missing.reference create mode 100644 dbms/tests/queries/0_stateless/00229_prewhere_column_missing.sql diff --git a/dbms/tests/queries/0_stateless/00229_prewhere_column_missing.reference b/dbms/tests/queries/0_stateless/00229_prewhere_column_missing.reference new file mode 100644 index 00000000000..4a5b4ff83a0 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00229_prewhere_column_missing.reference @@ -0,0 +1,5 @@ +2015-09-16 0 +2015-09-16 0 [] +2015-09-16 0 [] 0 +2015-09-16 0 [] 0 +2015-09-16 0 [] 0 diff --git a/dbms/tests/queries/0_stateless/00229_prewhere_column_missing.sql b/dbms/tests/queries/0_stateless/00229_prewhere_column_missing.sql new file mode 100644 index 00000000000..00d5a54ec43 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00229_prewhere_column_missing.sql @@ -0,0 +1,15 @@ +drop table if exists test_prewhere_column_missing; + +create table test_prewhere_column_missing (d default today(), x UInt64) engine=MergeTree(d, x, 1); + +insert into test_prewhere_column_missing (x) values (0); +select * from test_prewhere_column_missing; + +alter table test_prewhere_column_missing add column arr Array(UInt64); +select * from test_prewhere_column_missing; + +select *, arraySum(arr) as s from test_prewhere_column_missing; +select *, arraySum(arr) as s from test_prewhere_column_missing where s = 0; +select *, arraySum(arr) as s from test_prewhere_column_missing prewhere s = 0; + +drop table test_prewhere_column_missing;