PVS Studio fixes

This commit is contained in:
alesapin 2021-05-17 23:23:32 +03:00
parent 5563a0d7f3
commit 87c6e39a29
2 changed files with 5 additions and 9 deletions

View File

@ -466,6 +466,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::readFromParts(
real_column_names.push_back(ExpressionActions::getSmallestColumn(available_real_columns)); real_column_names.push_back(ExpressionActions::getSmallestColumn(available_real_columns));
metadata_snapshot->check(real_column_names, data.getVirtuals(), data.getStorageID()); metadata_snapshot->check(real_column_names, data.getVirtuals(), data.getStorageID());
auto index_stats = use_cache ? std::move(cache->index_stats) : std::make_unique<ReadFromMergeTree::IndexStats>();
// Build and check if primary key is used when necessary // Build and check if primary key is used when necessary
std::optional<KeyCondition> key_condition; std::optional<KeyCondition> key_condition;
@ -483,15 +484,8 @@ QueryPlanPtr MergeTreeDataSelectExecutor::readFromParts(
fmt::join(primary_key_columns, ", ")); fmt::join(primary_key_columns, ", "));
} }
LOG_DEBUG(log, "Key condition: {}", key_condition->toString()); LOG_DEBUG(log, "Key condition: {}", key_condition->toString());
}
const auto & select = query_info.query->as<ASTSelectQuery &>(); /// Select parts to read and do partition pruning via partition value and minmax indices
auto query_context = context->hasQueryContext() ? context->getQueryContext() : context;
auto index_stats = use_cache ? std::move(cache->index_stats) : std::make_unique<ReadFromMergeTree::IndexStats>();
// Select parts to read and do partition pruning via partition value and minmax indices
if (!use_cache)
{
std::optional<PartitionPruner> partition_pruner; std::optional<PartitionPruner> partition_pruner;
std::optional<KeyCondition> minmax_idx_condition; std::optional<KeyCondition> minmax_idx_condition;
DataTypes minmax_columns_types; DataTypes minmax_columns_types;
@ -523,6 +517,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::readFromParts(
} }
} }
auto query_context = context->hasQueryContext() ? context->getQueryContext() : context;
PartFilterCounters part_filter_counters; PartFilterCounters part_filter_counters;
if (query_context->getSettingsRef().allow_experimental_query_deduplication) if (query_context->getSettingsRef().allow_experimental_query_deduplication)
selectPartsToReadWithUUIDFilter( selectPartsToReadWithUUIDFilter(
@ -574,6 +569,7 @@ QueryPlanPtr MergeTreeDataSelectExecutor::readFromParts(
} }
} }
const auto & select = query_info.query->as<ASTSelectQuery &>();
/// Sampling. /// Sampling.
MergeTreeDataSelectSamplingData sampling = use_cache ? std::move(cache->sampling) : MergeTreeDataSelectSamplingData{}; MergeTreeDataSelectSamplingData sampling = use_cache ? std::move(cache->sampling) : MergeTreeDataSelectSamplingData{};
if (!use_cache) if (!use_cache)

View File

@ -101,7 +101,7 @@ public:
private: private:
/// Transient value for CAS. /// Transient value for CAS.
uint32_t version; uint32_t version = 0;
String znode_path; String znode_path;