diff --git a/src/Interpreters/evaluateConstantExpression.cpp b/src/Interpreters/evaluateConstantExpression.cpp index 2d1a77afe6a..3df138839ce 100644 --- a/src/Interpreters/evaluateConstantExpression.cpp +++ b/src/Interpreters/evaluateConstantExpression.cpp @@ -2,17 +2,20 @@ #include #include -#include +#include #include #include #include #include #include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -21,11 +24,6 @@ #include #include #include -#include -#include -#include -#include -#include #include @@ -396,7 +394,7 @@ namespace { DisjunctionList res; for (const auto & lhs_map : lhs) - for(const auto & rhs_map : rhs) + for (const auto & rhs_map : rhs) if (auto conj = andConjunctions(lhs_map, rhs_map)) res.emplace_back(std::move(*conj)); @@ -558,24 +556,6 @@ namespace return res; } - // bool isIndependentSubtree(const ActionsDAG::Node * node, const MatchedTrees::Matches & matches) - // { - // std::stack stack; - // stack.push(node); - // while (!stack.empty()) - // { - // const auto * cur = stack.top(); - // stack.pop(); - // if (findMatch(cur, matches)) - // return false; - - // for (const auto * child : node->children) - // stack.push(child); - // } - - // return true; - // } - std::optional analyze(const ActionsDAG::Node * node, const MatchedTrees::Matches & matches, const ContextPtr & context, size_t max_elements) { if (node->type == ActionsDAG::ActionType::FUNCTION) diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index 2f1623932f8..8b308dfaf0b 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -409,63 +409,6 @@ StorageDistributed::StorageDistributed( { } -// QueryProcessingStage::Enum -// StorageDistributed::getQueryProcessingStageAnalyzer( -// [[maybe_unused]] ContextPtr local_context, -// [[maybe_unused]] QueryProcessingStage::Enum to_stage, -// [[maybe_unused]] const StorageSnapshotPtr & storage_snapshot, -// [[maybe_unused]] SelectQueryInfo & query_info) const -// { -// if (query_info.query_tree) -// LOG_INFO(log, "getQueryProcessingStageAnalyzer tree {}", query_info.query_tree->dumpTree()); - -// if (query_info.table_expression) -// LOG_INFO(log, "getQueryProcessingStageAnalyzer table_expression {}", query_info.table_expression->dumpTree()); - -// if (query_info.filter_actions_dag) -// LOG_INFO(log, "getQueryProcessingStageAnalyzer dag {}", query_info.filter_actions_dag->dumpDAG()); - -// const auto & settings = local_context->getSettingsRef(); -// ClusterPtr cluster = getCluster(); -// size_t nodes = getClusterQueriedNodes(settings, cluster); - -// if (query_info.use_custom_key) -// { -// LOG_INFO(log, "Single shard cluster used with custom_key, transforming replicas into virtual shards"); -// query_info.cluster = cluster->getClusterWithReplicasAsShards(settings, settings.max_parallel_replicas); -// } -// else -// { -// query_info.cluster = cluster; - -// if (nodes > 1 && settings.optimize_skip_unused_shards) -// { -// /// Always calculate optimized cluster here, to avoid conditions during read() -// /// (Anyway it will be calculated in the read()) -// ClusterPtr optimized_cluster = getOptimizedCluster(local_context, storage_snapshot, query_info); -// if (optimized_cluster) -// { -// LOG_DEBUG(log, "Skipping irrelevant shards - the query will be sent to the following shards of the cluster (shard numbers): {}", -// makeFormattedListOfShards(optimized_cluster)); - -// cluster = optimized_cluster; -// query_info.optimized_cluster = cluster; - -// nodes = getClusterQueriedNodes(settings, cluster); -// } -// else -// { -// LOG_DEBUG(log, "Unable to figure out irrelevant shards from WHERE/PREWHERE clauses - the query will be sent to all shards of the cluster{}", -// has_sharding_key ? "" : " (no sharding key)"); -// } -// } -// } - - -// query_info.cluster = cluster; -// return QueryProcessingStage::WithMergeableState; -// } - QueryProcessingStage::Enum StorageDistributed::getQueryProcessingStage( ContextPtr local_context, QueryProcessingStage::Enum to_stage, @@ -473,10 +416,6 @@ QueryProcessingStage::Enum StorageDistributed::getQueryProcessingStage( SelectQueryInfo & query_info) const { const auto & settings = local_context->getSettingsRef(); - - // if (settings.allow_experimental_analyzer) - // return getQueryProcessingStageAnalyzer(local_context, to_stage, storage_snapshot, query_info); - ClusterPtr cluster = getCluster(); size_t nodes = getClusterQueriedNodes(settings, cluster); diff --git a/src/Storages/StorageDistributed.h b/src/Storages/StorageDistributed.h index cf26bf4e320..fa751fed069 100644 --- a/src/Storages/StorageDistributed.h +++ b/src/Storages/StorageDistributed.h @@ -209,9 +209,6 @@ private: std::optional getOptimizedQueryProcessingStage(const SelectQueryInfo & query_info, const Settings & settings) const; std::optional getOptimizedQueryProcessingStageAnalyzer(const SelectQueryInfo & query_info, const Settings & settings) const; - // QueryProcessingStage::Enum - // getQueryProcessingStageAnalyzer(ContextPtr, QueryProcessingStage::Enum, const StorageSnapshotPtr &, SelectQueryInfo &) const; - size_t getRandomShardIndex(const Cluster::ShardsInfo & shards); std::string getClusterName() const { return cluster_name.empty() ? "" : cluster_name; }