#include #include #include #include #include #include #include #include #include #include namespace DB { BlockIO InterpreterExistsQuery::execute() { BlockIO res; res.in = executeImpl(); res.in_sample = getSampleBlock(); return res; } Block InterpreterExistsQuery::getSampleBlock() { return {{ std::make_shared(0, 0), std::make_shared(), "result" }}; } BlockInputStreamPtr InterpreterExistsQuery::executeImpl() { const ASTExistsQuery & ast = typeid_cast(*query_ptr); bool res = context.isTableExist(ast.database, ast.table); return std::make_shared(Block{{ std::make_shared(1, res), std::make_shared(), "result" }}); } }