From c3096805ac9fffc096a10507cdadb2fd6edd5e2c Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Wed, 25 Aug 2021 08:39:41 +0300 Subject: [PATCH] Update 01213_optimize_skip_unused_shards_DISTINCT --- ...213_optimize_skip_unused_shards_DISTINCT.reference | 7 ++++++- .../01213_optimize_skip_unused_shards_DISTINCT.sql | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.reference b/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.reference index 4ade9cd9c5d..febec683df9 100644 --- a/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.reference +++ b/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.reference @@ -3,6 +3,11 @@ distributed_group_by_no_merge 1 optimize_skip_unused_shards 1 -optimize_skip_unused_shards lack of WHERE +optimize_skip_unused_shards lack of WHERE (optimize_distributed_group_by_sharding_key=0) +0 +1 +optimize_skip_unused_shards lack of WHERE (optimize_distributed_group_by_sharding_key=1) +0 +1 0 1 diff --git a/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.sql b/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.sql index 5b45bea9046..8024abc75ed 100644 --- a/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.sql +++ b/tests/queries/0_stateless/01213_optimize_skip_unused_shards_DISTINCT.sql @@ -12,8 +12,15 @@ SELECT DISTINCT id FROM dist_01213 WHERE id = 1 SETTINGS distributed_group_by_no SELECT 'optimize_skip_unused_shards'; SELECT DISTINCT id FROM dist_01213 WHERE id = 1 SETTINGS optimize_skip_unused_shards=1; -- check that querying all shards is ok -SELECT 'optimize_skip_unused_shards lack of WHERE'; -SELECT DISTINCT id FROM dist_01213 SETTINGS optimize_skip_unused_shards=1; +SELECT 'optimize_skip_unused_shards lack of WHERE (optimize_distributed_group_by_sharding_key=0)'; +SELECT DISTINCT id FROM dist_01213 SETTINGS optimize_skip_unused_shards=1, optimize_distributed_group_by_sharding_key=0; +-- with optimize_distributed_group_by_sharding_key=1 there will be 4 rows, +-- since DISTINCT will be done on each shard separatelly, and initiator will +-- not do anything (since we use optimize_skip_unused_shards=1 that must +-- guarantee that the data had been INSERTed according to sharding key, +-- which is not our case, since we use one local table). +SELECT 'optimize_skip_unused_shards lack of WHERE (optimize_distributed_group_by_sharding_key=1)'; +SELECT DISTINCT id FROM dist_01213 SETTINGS optimize_skip_unused_shards=1, optimize_distributed_group_by_sharding_key=1; DROP TABLE local_01213; DROP TABLE dist_01213;