Merge pull request #4637 from digitalist/use_sampling-fix-for-parallel-replicas

fix use_sampling for parallel replicas (mpetrov/madmike)
This commit is contained in:
alexey-milovidov 2019-03-10 19:02:40 +03:00 committed by GitHub
commit c7c58785b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -368,14 +368,11 @@ BlockInputStreams 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.
*/
bool use_sampling = relative_sample_size > 0 || settings.parallel_replicas_count > 1;
bool use_sampling = relative_sample_size > 0 || (settings.parallel_replicas_count > 1 && data.supportsSampling());
bool no_data = false; /// There is nothing left after sampling.
if (use_sampling)
{
if (!data.supportsSampling())
throw Exception("Illegal SAMPLE: table doesn't support sampling", ErrorCodes::SAMPLING_NOT_SUPPORTED);
if (sample_factor_column_queried && relative_sample_size != RelativeSize(0))
used_sample_factor = 1.0 / boost::rational_cast<Float64>(relative_sample_size);