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

Method tryGetTableInWorkerResource

src/Interpreters/InterpreterInsertQuery.cpp:234–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234StoragePtr InterpreterInsertQuery::tryGetTableInWorkerResource(const StorageID & table_id)
235{
236 /// in some case of bitengine, server will write data into dict table and the targe table
237 /// can only be found in worker_resource
238 auto try_get_table_from_worker_resource = [&table_id](const auto & context) -> StoragePtr {
239 if (auto worker_resource = context->tryGetCnchWorkerResource(); worker_resource)
240 return worker_resource->getTable(table_id);
241 else
242 return nullptr;
243 };
244 auto storage = try_get_table_from_worker_resource(getContext());
245 if (storage)
246 return storage;
247 else if (auto query_context = getContext()->getQueryContext())
248 {
249 storage = try_get_table_from_worker_resource(query_context);
250 if (storage)
251 return storage;
252 }
253 return nullptr;
254}
255
256Block InterpreterInsertQuery::getSampleBlock(
257 const ASTInsertQuery & query, const StoragePtr & table, const StorageMetadataPtr & metadata_snapshot) const

Callers

nothing calls this directly

Calls 3

getTableMethod · 0.45
getQueryContextMethod · 0.45

Tested by

no test coverage detected