#include #include #include #include #include #include #include #include #include #include #include #include namespace DB { namespace { Block getResultRow(const BackupOperationInfo & info) { auto column_id = ColumnString::create(); auto column_status = ColumnInt8::create(); column_id->insert(info.id); column_status->insert(static_cast(info.status)); Block res_columns; res_columns.insert(0, {std::move(column_id), std::make_shared(), "id"}); res_columns.insert(1, {std::move(column_status), std::make_shared(getBackupStatusEnumValues()), "status"}); return res_columns; } } BlockIO InterpreterBackupQuery::execute() { auto & backups_worker = context->getBackupsWorker(); auto id = backups_worker.start(query_ptr, context); auto info = backups_worker.getInfo(id); if (info.exception) std::rethrow_exception(info.exception); BlockIO res_io; res_io.pipeline = QueryPipeline(std::make_shared(getResultRow(info))); return res_io; } void registerInterpreterBackupQuery(InterpreterFactory & factory) { auto create_fn = [] (const InterpreterFactory::Arguments & args) { return std::make_unique(args.query, args.context); }; factory.registerInterpreter("InterpreterBackupQuery", create_fn); } }