From f5ba4f4ed8850b777ea444f06d71494ef614f409 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Tue, 21 Apr 2020 12:59:46 +0300 Subject: [PATCH] Added test. --- ...o_merge_with-extremes_and_totals.reference | 289 ++++++++++++++++++ ...p_by_no_merge_with-extremes_and_totals.sql | 106 +++++++ 2 files changed, 395 insertions(+) create mode 100644 tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.reference create mode 100644 tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.sql diff --git a/tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.reference b/tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.reference new file mode 100644 index 00000000000..3e6590d769c --- /dev/null +++ b/tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.reference @@ -0,0 +1,289 @@ +20 +20 + +20 +distributed_group_by_no_merge = 0, extremes = 0 +10 +- +10 +- +10 + +10 +- +10 + +10 +------ +10 +- +10 +- +20 +- +20 +------ +10 + +10 +- +10 + +10 +- +20 + +20 +- +20 + +20 +distributed_group_by_no_merge = 1, extremes = 0 +10 +- +10 +- +10 + +10 +- +10 + +10 +------ +10 +- +10 +- +20 +- +20 +------ +10 + +10 +- +10 + +10 +- +20 + +20 +- +20 + +20 +distributed_group_by_no_merge = 0, extremes = 1 +10 + +10 +10 +- + +- +- +10 + +10 +10 +- + +- +- +10 + +10 + +10 +10 +- + +- +- +10 + +10 + +10 +10 +------ + +------ +------ +10 + +10 +10 +- + +- +- +10 + +10 +10 +- + +- +- +20 + +20 +20 +- + +- +- +20 + +20 +20 +------ + +------ +------ +10 + +10 + +10 +10 +- + +- +- +10 + +10 + +10 +10 +- + +- +- +20 + +20 + +20 +20 +- + +- +- +20 + +20 + +20 +20 +distributed_group_by_no_merge = 1, extremes = 1 + +distributed_group_by_no_merge = 1, extremes = 1 +distributed_group_by_no_merge = 1, extremes = 1 +10 + +10 +10 +- + +- +- +10 + +10 +10 +- + +- +- +10 + +10 + +10 +10 +- + +- +- +10 + +10 + +10 +10 +------ + +------ +------ +10 + +10 +10 +- + +- +- +10 + +10 +10 +- + +- +- +20 + +20 +20 +- + +- +- +20 + +20 +20 +------ + +------ +------ +10 + +10 + +10 +10 +- + +- +- +10 + +10 + +10 +10 +- + +- +- +20 + +20 + +20 +20 +- + +- +- +20 + +20 + +20 +20 diff --git a/tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.sql b/tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.sql new file mode 100644 index 00000000000..030330e4cae --- /dev/null +++ b/tests/queries/0_stateless/01245_distributed_group_by_no_merge_with-extremes_and_totals.sql @@ -0,0 +1,106 @@ +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.{1,2}', system.numbers) LIMIT 5 SETTINGS distributed_group_by_no_merge = 1); +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.{1,2}', system.numbers) LIMIT 5 SETTINGS distributed_group_by_no_merge = 1) with totals; + +SELECT 'distributed_group_by_no_merge = 0, extremes = 0'; +SET distributed_group_by_no_merge = 0, extremes = 0; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5) with totals; +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5) with totals; +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5)) with totals); +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5))) with totals; + +SELECT 'distributed_group_by_no_merge = 1, extremes = 0'; +SET distributed_group_by_no_merge = 1, extremes = 0; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5) with totals; +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5) with totals; +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5)) with totals); +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5))) with totals; + +SELECT 'distributed_group_by_no_merge = 0, extremes = 1'; +SET distributed_group_by_no_merge = 0, extremes = 1; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5) with totals; +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5) with totals; +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5)) with totals); +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5))) with totals; + +SELECT 'distributed_group_by_no_merge = 1, extremes = 1'; +SET distributed_group_by_no_merge = 1, extremes = 1; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5); +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.1', system.numbers) LIMIT 5) with totals; +SELECT '-'; +SELECT sum(number) FROM (SELECT * FROM remote('127.0.0.2', system.numbers) LIMIT 5) with totals; +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5)) with totals); +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5)) with totals); +SELECT '------'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.1', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.2', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{1,2}', numbers(5))) with totals; +SELECT '-'; +SELECT sum(s) FROM (SELECT sum(number) as s FROM remote('127.0.0.{2,3}', numbers(5))) with totals;