#include #include #include #include #include #include #include namespace DB { InterpreterQuery::InterpreterQuery(ASTPtr query_ptr_, Context & context_, size_t max_block_size_) : query_ptr(query_ptr_), context(context_), max_block_size(max_block_size_) { } void InterpreterQuery::execute(WriteBuffer & ostr, SharedPtr remaining_data_istr, BlockInputStreamPtr & query_plan) { if (dynamic_cast(&*query_ptr)) { InterpreterSelectQuery interpreter(query_ptr, context, max_block_size); query_plan = interpreter.executeAndFormat(ostr); } else if (dynamic_cast(&*query_ptr)) { InterpreterInsertQuery interpreter(query_ptr, context, max_block_size); interpreter.execute(remaining_data_istr); } else if (dynamic_cast(&*query_ptr)) { InterpreterCreateQuery interpreter(query_ptr, context, max_block_size); interpreter.execute(); } else throw Exception("Unknown type of query: " + query_ptr->getID(), ErrorCodes::UNKNOWN_TYPE_OF_QUERY); } }