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