mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Merge pull request #68321 from ClickHouse/sampling-key-race
Fix data race on SampleKey
This commit is contained in:
commit
aa0e4beae6
@ -369,7 +369,7 @@ MergeTreeDataSelectSamplingData MergeTreeDataSelectExecutor::getSampling(
|
||||
/// If sample and final are used together no need to calculate sampling expression twice.
|
||||
/// The first time it was calculated for final, because sample key is a part of the PK.
|
||||
/// So, assume that we already have calculated column.
|
||||
ASTPtr sampling_key_ast = metadata_snapshot->getSamplingKeyAST();
|
||||
ASTPtr sampling_key_ast;
|
||||
|
||||
if (final)
|
||||
{
|
||||
@ -377,6 +377,12 @@ MergeTreeDataSelectSamplingData MergeTreeDataSelectExecutor::getSampling(
|
||||
/// We do spoil available_real_columns here, but it is not used later.
|
||||
available_real_columns.emplace_back(sampling_key.column_names[0], std::move(sampling_column_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
sampling_key_ast = metadata_snapshot->getSamplingKeyAST()->clone();
|
||||
}
|
||||
|
||||
chassert(sampling_key_ast != nullptr);
|
||||
|
||||
if (has_lower_limit)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user