MCPcopy Create free account
hub / github.com/ByConity/ByConity / executeQuery

Function executeQuery

src/Interpreters/ClusterProxy/executeQuery.cpp:172–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172void executeQuery(
173 QueryPlan & query_plan,
174 IStreamFactory & stream_factory, Poco::Logger * log,
175 const ASTPtr & query_ast, ContextPtr context, const SelectQueryInfo & query_info,
176 const ExpressionActionsPtr & sharding_key_expr,
177 const std::string & sharding_key_column_name,
178 const ClusterPtr & not_optimized_cluster)
179{
180 assert(log);
181
182 const Settings & settings = context->getSettingsRef();
183
184 if (settings.max_distributed_depth && context->getClientInfo().distributed_depth > settings.max_distributed_depth)
185 throw Exception("Maximum distributed depth exceeded", ErrorCodes::TOO_LARGE_DISTRIBUTED_DEPTH);
186
187 std::vector<QueryPlanPtr> plans;
188 Pipes remote_pipes;
189 Pipes delayed_pipes;
190
191 auto new_context = updateSettingsForCluster(*query_info.getCluster(), context, settings, log);
192
193 new_context->getClientInfo().distributed_depth += 1;
194
195 ThrottlerPtr user_level_throttler;
196 if (auto * process_list_element = context->getProcessListElement())
197 user_level_throttler = process_list_element->getUserNetworkThrottler();
198
199 /// Network bandwidth limit, if needed.
200 ThrottlerPtr throttler;
201 if (settings.max_network_bandwidth || settings.max_network_bytes)
202 {
203 throttler = std::make_shared<Throttler>(
204 settings.max_network_bandwidth,
205 settings.max_network_bytes,
206 "Limit for bytes to send or receive over network exceeded.",
207 user_level_throttler);
208 }
209 else
210 throttler = user_level_throttler;
211
212 ASTPtr rewrite_ast = query_ast;
213
214 std::set<UInt32> skip_shards;
215 std::vector<String> skip_shards_str;
216 String skip_shard_list = settings.skip_shard_list;
217 boost::split(skip_shards_str, skip_shard_list, boost::is_any_of(" ,"));
218 for (auto& shard : skip_shards_str)
219 {
220 if (shard.empty()) continue; // default empty setting
221 try
222 {
223 skip_shards.insert(std::stoi(shard));
224 }
225 catch(...)
226 {
227 throw Exception("skip_shard_list setting wrong " + skip_shard_list, ErrorCodes::UNKNOWN_SETTING);
228 }
229 }

Callers 2

executeMethod · 0.50
executeMethod · 0.50

Calls 15

updateSettingsForClusterFunction · 0.85
getProcessListElementMethod · 0.80
createForShardMethod · 0.80
setStepDescriptionMethod · 0.80
frontMethod · 0.80
unitePlansMethod · 0.80
ExceptionClass · 0.50
splitFunction · 0.50
getClusterMethod · 0.45

Tested by

no test coverage detected