mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Two more fixes for PVS-Studio
This commit is contained in:
parent
6577ecec90
commit
f40b70884f
@ -61,6 +61,8 @@ public:
|
||||
randomize(randomize_), max_iterations(max_iterations_), max_time(max_time_),
|
||||
json_path(json_path_), settings(settings_), global_context(Context::createGlobal()), pool(concurrency)
|
||||
{
|
||||
global_context.makeGlobalContext();
|
||||
|
||||
std::cerr << std::fixed << std::setprecision(3);
|
||||
|
||||
/// This is needed to receive blocks with columns of AggregateFunction data type
|
||||
|
@ -218,6 +218,7 @@ private:
|
||||
|
||||
configReadClient(config(), home_path);
|
||||
|
||||
global_context.makeGlobalContext();
|
||||
context.setApplicationType(Context::ApplicationType::CLIENT);
|
||||
|
||||
/// settings and limits could be specified in config file, but passed settings has higher priority
|
||||
|
@ -2171,6 +2171,7 @@ void ClusterCopierApp::mainImpl()
|
||||
<< "revision " << ClickHouseRevision::get() << ")");
|
||||
|
||||
auto context = std::make_unique<Context>(Context::createGlobal());
|
||||
context->makeGlobalContext();
|
||||
SCOPE_EXIT(context->shutdown());
|
||||
|
||||
context->setConfig(loaded_config.configuration);
|
||||
|
@ -131,6 +131,7 @@ try
|
||||
|
||||
|
||||
context = std::make_unique<Context>(Context::createGlobal());
|
||||
context->makeGlobalContext();
|
||||
context->setApplicationType(Context::ApplicationType::LOCAL);
|
||||
tryInitPath();
|
||||
|
||||
|
@ -1024,6 +1024,7 @@ try
|
||||
}
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context->makeGlobalContext();
|
||||
|
||||
ReadBufferFromFileDescriptor file_in(STDIN_FILENO);
|
||||
WriteBufferFromFileDescriptor file_out(STDOUT_FILENO);
|
||||
|
@ -160,6 +160,7 @@ int ODBCBridge::main(const std::vector<std::string> & /*args*/)
|
||||
http_params->setKeepAliveTimeout(keep_alive_timeout);
|
||||
|
||||
context = std::make_shared<Context>(Context::createGlobal());
|
||||
context->makeGlobalContext();
|
||||
|
||||
auto server = Poco::Net::HTTPServer(
|
||||
new HandlerFactory("ODBCRequestHandlerFactory-factory", keep_alive_timeout, context), server_pool, socket, http_params);
|
||||
|
@ -127,6 +127,7 @@ private:
|
||||
std::unordered_map<std::string, std::vector<size_t>> query_indexes;
|
||||
|
||||
Context global_context = Context::createGlobal();
|
||||
global_context.makeGlobalContext();
|
||||
std::shared_ptr<ReportBuilder> report_builder;
|
||||
|
||||
std::string server_version;
|
||||
|
@ -187,6 +187,7 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
* settings, available functions, data types, aggregate functions, databases...
|
||||
*/
|
||||
global_context = std::make_unique<Context>(Context::createGlobal());
|
||||
global_context->makeGlobalContext();
|
||||
global_context->setApplicationType(Context::ApplicationType::SERVER);
|
||||
|
||||
bool has_zookeeper = config().has("zookeeper");
|
||||
|
@ -68,6 +68,7 @@ try
|
||||
CollapsingFinalBlockInputStream collapsed(inputs, descr, "Sign");
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
WriteBufferFromFileDescriptor out_buf(STDERR_FILENO);
|
||||
BlockOutputStreamPtr output = context.getOutputFormat("TabSeparated", out_buf, block1);
|
||||
|
||||
|
@ -35,6 +35,7 @@ try
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
NamesAndTypesList source_columns = {{"number", std::make_shared<DataTypeUInt64>()}};
|
||||
auto syntax_result = SyntaxAnalyzer(context, {}).analyze(ast, source_columns);
|
||||
|
@ -40,6 +40,7 @@ try
|
||||
std::cerr << std::endl;
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
NamesAndTypesList source_columns = {{"number", std::make_shared<DataTypeUInt64>()}};
|
||||
auto syntax_result = SyntaxAnalyzer(context, {}).analyze(ast, source_columns);
|
||||
|
@ -23,6 +23,7 @@ int main(int, char **)
|
||||
try
|
||||
{
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
Settings settings = context.getSettings();
|
||||
|
||||
context.setPath("./");
|
||||
|
@ -305,7 +305,6 @@ Context Context::createGlobal(std::unique_ptr<IRuntimeComponentsFactory> runtime
|
||||
Context res;
|
||||
res.shared = std::make_shared<ContextShared>(std::move(runtime_components_factory));
|
||||
res.quota = std::make_shared<QuotaForIntervals>();
|
||||
res.global_context = &res;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -347,6 +347,7 @@ public:
|
||||
|
||||
void makeQueryContext() { query_context = this; }
|
||||
void makeSessionContext() { session_context = this; }
|
||||
void makeGlobalContext() { global_context = this; }
|
||||
|
||||
const Settings & getSettingsRef() const { return settings; }
|
||||
Settings & getSettingsRef() { return settings; }
|
||||
|
@ -79,6 +79,7 @@ try
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
context.setPath("./");
|
||||
auto database = std::make_shared<DatabaseOrdinary>("test", "./metadata/test/", context);
|
||||
|
@ -47,6 +47,7 @@ int main(int argc, char ** argv)
|
||||
std::cerr << std::endl;
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
NamesAndTypesList columns
|
||||
{
|
||||
{"x", std::make_shared<DataTypeInt16>()},
|
||||
|
@ -97,6 +97,7 @@ int main()
|
||||
};
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
auto system_database = std::make_shared<DatabaseMemory>("system");
|
||||
context.addDatabase("system", system_database);
|
||||
|
@ -1158,6 +1158,7 @@ bool run()
|
||||
TestResult check(const TestEntry & entry)
|
||||
{
|
||||
static DB::Context context = DB::Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -31,6 +31,7 @@ try
|
||||
DateLUT::instance();
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
context.setPath("./");
|
||||
|
||||
|
@ -29,6 +29,7 @@ struct State
|
||||
registerFunctions();
|
||||
DatabasePtr database = std::make_shared<DatabaseMemory>("test");
|
||||
database->attachTable("table", StorageMemory::create("table", ColumnsDescription{columns}));
|
||||
context.makeGlobalContext();
|
||||
context.addDatabase("test", database);
|
||||
context.setCurrentDatabase("test");
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ try
|
||||
table->startup();
|
||||
|
||||
auto context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
|
||||
/// write into it
|
||||
{
|
||||
|
@ -26,9 +26,10 @@ try
|
||||
|
||||
WriteBufferFromOStream out_buf(std::cout);
|
||||
|
||||
QueryProcessingStage::Enum stage = table->getQueryProcessingStage(Context::createGlobal());
|
||||
|
||||
auto context = Context::createGlobal();
|
||||
context.makeGlobalContext();
|
||||
QueryProcessingStage::Enum stage = table->getQueryProcessingStage(context);
|
||||
|
||||
LimitBlockInputStream input(table->read(column_names, {}, context, stage, 10, 1)[0], 10, 96);
|
||||
BlockOutputStreamPtr out = FormatFactory::instance().getOutput("TabSeparated", out_buf, sample, context);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user