diff --git a/tests/queries/0_stateless/01345_array_join_LittleMaverick.reference b/tests/queries/0_stateless/01345_array_join_LittleMaverick.reference new file mode 100644 index 00000000000..83fdd14d0c8 --- /dev/null +++ b/tests/queries/0_stateless/01345_array_join_LittleMaverick.reference @@ -0,0 +1,2 @@ +NEW 2 +\N 2 diff --git a/tests/queries/0_stateless/01345_array_join_LittleMaverick.sql b/tests/queries/0_stateless/01345_array_join_LittleMaverick.sql new file mode 100644 index 00000000000..ba6842886d8 --- /dev/null +++ b/tests/queries/0_stateless/01345_array_join_LittleMaverick.sql @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS test; + +CREATE TABLE test +( + `id` Nullable(String), + `status` Nullable(Enum8('NEW' = 0, 'CANCEL' = 1)), + `nested.nestedType` Array(Nullable(String)), + `partition` Date +) ENGINE = MergeTree() PARTITION BY partition +ORDER BY + partition SETTINGS index_granularity = 8192; + +INSERT INTO test VALUES ('1', 'NEW', array('a', 'b'), now()); + +SELECT + status, + count() AS all +FROM test ARRAY JOIN nested as nestedJoined +WHERE (status IN ( + SELECT status + FROM test ARRAY JOIN nested as nestedJoined + GROUP BY status + ORDER BY count() DESC + LIMIT 10)) AND (id IN ('1', '2')) +GROUP BY CUBE(status) +LIMIT 100; + +DROP TABLE test; diff --git a/tests/queries/0_stateless/01346_array_join_mrxotey.reference b/tests/queries/0_stateless/01346_array_join_mrxotey.reference new file mode 100644 index 00000000000..6ed281c757a --- /dev/null +++ b/tests/queries/0_stateless/01346_array_join_mrxotey.reference @@ -0,0 +1,2 @@ +1 +1 diff --git a/tests/queries/0_stateless/01346_array_join_mrxotey.sql b/tests/queries/0_stateless/01346_array_join_mrxotey.sql new file mode 100644 index 00000000000..b57b7fadcdd --- /dev/null +++ b/tests/queries/0_stateless/01346_array_join_mrxotey.sql @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS test; + +CREATE TABLE test ( + a Date, + b UInt32, + c UInt64, + p Nested ( + at1 String, + at2 String + ) +) ENGINE = MergeTree() +PARTITION BY a +ORDER BY b +SETTINGS index_granularity = 8192; + +INSERT INTO test (a, b, c, p.at1, p.at2) +VALUES (now(), 1, 2, ['foo', 'bar'], ['baz', 'qux']); + +SELECT b +FROM test +ARRAY JOIN p +WHERE + b = 1 + AND c IN ( + SELECT c FROM test + ); + +DROP TABLE test;