mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #16675 from ClickHouse/max_parallel_replicas_without_sampling
Fix 'max_parallel_replicas' without sampling.
This commit is contained in:
commit
5d8844b66e
@ -366,6 +366,15 @@ Pipe MergeTreeDataSelectExecutor::readFromParts(
|
|||||||
* It is also important that the entire universe can be covered using SAMPLE 0.1 OFFSET 0, ... OFFSET 0.9 and similar decimals.
|
* It is also important that the entire universe can be covered using SAMPLE 0.1 OFFSET 0, ... OFFSET 0.9 and similar decimals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// Parallel replicas has been requested but there is no way to sample data.
|
||||||
|
/// Select all data from first replica and no data from other replicas.
|
||||||
|
if (settings.parallel_replicas_count > 1 && !data.supportsSampling() && settings.parallel_replica_offset > 0)
|
||||||
|
{
|
||||||
|
LOG_DEBUG(log, "Will use no data on this replica because parallel replicas processing has been requested"
|
||||||
|
" (the setting 'max_parallel_replicas') but the table does not support sampling and this replica is not the first.");
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
bool use_sampling = relative_sample_size > 0 || (settings.parallel_replicas_count > 1 && data.supportsSampling());
|
bool use_sampling = relative_sample_size > 0 || (settings.parallel_replicas_count > 1 && data.supportsSampling());
|
||||||
bool no_data = false; /// There is nothing left after sampling.
|
bool no_data = false; /// There is nothing left after sampling.
|
||||||
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
Hello
|
||||||
|
1000
|
||||||
|
1000
|
||||||
|
1000
|
@ -0,0 +1,22 @@
|
|||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
CREATE TABLE t (x String) ENGINE = MergeTree ORDER BY x;
|
||||||
|
INSERT INTO t VALUES ('Hello');
|
||||||
|
|
||||||
|
SET max_parallel_replicas = 3;
|
||||||
|
SELECT * FROM remote('127.0.0.{2|3|4}', currentDatabase(), t);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
CREATE TABLE t (x String) ENGINE = MergeTree ORDER BY cityHash64(x) SAMPLE BY cityHash64(x);
|
||||||
|
INSERT INTO t SELECT toString(number) FROM numbers(1000);
|
||||||
|
|
||||||
|
SET max_parallel_replicas = 1;
|
||||||
|
SELECT count() FROM remote('127.0.0.{2|3|4}', currentDatabase(), t);
|
||||||
|
|
||||||
|
SET max_parallel_replicas = 2;
|
||||||
|
SELECT count() FROM remote('127.0.0.{2|3|4}', currentDatabase(), t);
|
||||||
|
|
||||||
|
SET max_parallel_replicas = 3;
|
||||||
|
SELECT count() FROM remote('127.0.0.{2|3|4}', currentDatabase(), t);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
@ -159,3 +159,4 @@
|
|||||||
01547_query_log_current_database
|
01547_query_log_current_database
|
||||||
01548_query_log_query_execution_ms
|
01548_query_log_query_execution_ms
|
||||||
01552_dict_fixedstring
|
01552_dict_fixedstring
|
||||||
|
01557_max_parallel_replicas_no_sample.sql
|
||||||
|
Loading…
Reference in New Issue
Block a user