ClickHouse/src/Interpreters/InterpreterShowProcesslistQuery.cpp
Bharat Nallan ee37f551a2
independent registration of interpreters (#58443)
* make interpreter factory an instance

* add registerInterpreter

* register interpreters individually

* try wire everything up

* fix style

* fix test
2024-01-08 22:33:48 -08:00

29 lines
798 B
C++

#include <IO/ReadBufferFromString.h>
#include <Interpreters/Context.h>
#include <Interpreters/executeQuery.h>
#include <Interpreters/InterpreterFactory.h>
#include <Interpreters/InterpreterShowProcesslistQuery.h>
#include <Parsers/ASTQueryWithOutput.h>
namespace DB
{
BlockIO InterpreterShowProcesslistQuery::execute()
{
return executeQuery("SELECT * FROM system.processes ORDER BY elapsed DESC", getContext(), QueryFlags{ .internal = true }).second;
}
void registerInterpreterShowProcesslistQuery(InterpreterFactory & factory)
{
auto create_fn = [] (const InterpreterFactory::Arguments & args)
{
return std::make_unique<InterpreterShowProcesslistQuery>(args.query, args.context);
};
factory.registerInterpreter("InterpreterShowProcesslistQuery", create_fn);
}
}