#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace ProfileEvents { extern const Event Query; extern const Event SelectQuery; extern const Event InsertQuery; } namespace DB { namespace ErrorCodes { extern const int READONLY; extern const int UNKNOWN_TYPE_OF_QUERY; extern const int QUERY_IS_PROHIBITED; } std::unique_ptr InterpreterFactory::get(ASTPtr & query, Context & context, QueryProcessingStage::Enum stage) { ProfileEvents::increment(ProfileEvents::Query); if (query->as()) { /// This is internal part of ASTSelectWithUnionQuery. /// Even if there is SELECT without union, it is represented by ASTSelectWithUnionQuery with single ASTSelectQuery as a child. return std::make_unique(query, context, SelectQueryOptions(stage)); } else if (query->as()) { ProfileEvents::increment(ProfileEvents::SelectQuery); return std::make_unique(query, context, SelectQueryOptions(stage)); } else if (query->as()) { ProfileEvents::increment(ProfileEvents::InsertQuery); bool allow_materialized = static_cast(context.getSettingsRef().insert_allow_materialized_columns); return std::make_unique(query, context, allow_materialized); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { /// readonly is checked inside InterpreterSetQuery return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else if (query->as()) { return std::make_unique(query, context); } else throw Exception("Unknown type of query: " + query->getID(), ErrorCodes::UNKNOWN_TYPE_OF_QUERY); } }