#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 #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 QueriesWithSubqueries; extern const Event SelectQuery; extern const Event InsertQuery; } namespace DB { namespace ErrorCodes { extern const int UNKNOWN_TYPE_OF_QUERY; } std::unique_ptr InterpreterFactory::get(ASTPtr & query, ContextMutablePtr context, const SelectQueryOptions & options) { ProfileEvents::increment(ProfileEvents::Query); /// SELECT and INSERT query will handle QueriesWithSubqueries on their own. if (!(query->as() || query->as() || query->as() || query->as())) { ProfileEvents::increment(ProfileEvents::QueriesWithSubqueries); } if (query->as()) { if (context->getSettingsRef().allow_experimental_analyzer) return std::make_unique(query, context, options); /// 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, options); } else if (query->as()) { ProfileEvents::increment(ProfileEvents::SelectQuery); if (context->getSettingsRef().allow_experimental_analyzer) return std::make_unique(query, context, options); return std::make_unique(query, context, options); } else if (query->as()) { return std::make_unique(query, context, options); } 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()) { 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 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(ErrorCodes::UNKNOWN_TYPE_OF_QUERY, "Unknown type of query: {}", query->getID()); } } }