2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTAlterQuery.h>
|
2021-08-18 22:19:14 +00:00
|
|
|
#include <Parsers/ASTBackupQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTCheckQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ASTCreateQuery.h>
|
2021-08-23 14:31:58 +00:00
|
|
|
#include <Parsers/ASTCreateFunctionQuery.h>
|
2022-06-16 09:58:14 +00:00
|
|
|
#include <Parsers/ASTCreateIndexQuery.h>
|
2022-06-07 05:20:46 +00:00
|
|
|
#include <Parsers/ASTDeleteQuery.h>
|
2021-05-14 22:43:04 +00:00
|
|
|
#include <Parsers/ASTDropFunctionQuery.h>
|
2022-06-17 07:46:44 +00:00
|
|
|
#include <Parsers/ASTDropIndexQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ASTDropQuery.h>
|
2023-03-21 12:14:26 +00:00
|
|
|
#include <Parsers/ASTUndropQuery.h>
|
2021-04-16 20:18:39 +00:00
|
|
|
#include <Parsers/ASTExplainQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTInsertQuery.h>
|
2021-08-12 11:42:51 +00:00
|
|
|
#include <Parsers/ASTSelectIntersectExceptQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTKillQueryQuery.h>
|
|
|
|
#include <Parsers/ASTOptimizeQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ASTRenameQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTSelectQuery.h>
|
2018-02-25 06:34:20 +00:00
|
|
|
#include <Parsers/ASTSelectWithUnionQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Parsers/ASTSetQuery.h>
|
2023-01-31 15:35:10 +00:00
|
|
|
#include <Parsers/ASTShowEngineQuery.h>
|
2020-05-07 02:45:27 +00:00
|
|
|
#include <Parsers/ASTShowProcesslistQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTShowTablesQuery.h>
|
2023-03-26 14:36:38 +00:00
|
|
|
#include <Parsers/ASTShowColumnsQuery.h>
|
2023-04-25 18:04:19 +00:00
|
|
|
#include <Parsers/ASTShowIndexesQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Parsers/ASTUseQuery.h>
|
2019-05-28 21:17:48 +00:00
|
|
|
#include <Parsers/ASTWatchQuery.h>
|
2022-11-11 21:19:58 +00:00
|
|
|
#include <Parsers/ASTCreateNamedCollectionQuery.h>
|
|
|
|
#include <Parsers/ASTDropNamedCollectionQuery.h>
|
|
|
|
#include <Parsers/ASTAlterNamedCollectionQuery.h>
|
2020-07-01 05:00:50 +00:00
|
|
|
#include <Parsers/MySQL/ASTCreateQuery.h>
|
2021-03-31 17:55:04 +00:00
|
|
|
#include <Parsers/ASTTransactionControl.h>
|
2021-04-16 20:18:39 +00:00
|
|
|
#include <Parsers/TablePropertiesQueriesASTs.h>
|
2015-06-18 02:11:05 +00:00
|
|
|
|
2021-10-31 08:51:20 +00:00
|
|
|
#include <Parsers/Access/ASTCreateQuotaQuery.h>
|
|
|
|
#include <Parsers/Access/ASTCreateRoleQuery.h>
|
|
|
|
#include <Parsers/Access/ASTCreateRowPolicyQuery.h>
|
|
|
|
#include <Parsers/Access/ASTCreateSettingsProfileQuery.h>
|
|
|
|
#include <Parsers/Access/ASTCreateUserQuery.h>
|
|
|
|
#include <Parsers/Access/ASTDropAccessEntityQuery.h>
|
|
|
|
#include <Parsers/Access/ASTGrantQuery.h>
|
|
|
|
#include <Parsers/Access/ASTSetRoleQuery.h>
|
|
|
|
#include <Parsers/Access/ASTShowAccessEntitiesQuery.h>
|
|
|
|
#include <Parsers/Access/ASTShowAccessQuery.h>
|
|
|
|
#include <Parsers/Access/ASTShowCreateAccessEntityQuery.h>
|
|
|
|
#include <Parsers/Access/ASTShowGrantsQuery.h>
|
|
|
|
#include <Parsers/Access/ASTShowPrivilegesQuery.h>
|
2022-06-21 13:42:36 +00:00
|
|
|
#include <Parsers/ASTDescribeCacheQuery.h>
|
2021-10-31 08:51:20 +00:00
|
|
|
|
2020-07-01 06:42:22 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterAlterQuery.h>
|
2021-08-18 22:19:14 +00:00
|
|
|
#include <Interpreters/InterpreterBackupQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterCheckQuery.h>
|
2021-05-09 09:47:29 +00:00
|
|
|
#include <Interpreters/InterpreterCreateFunctionQuery.h>
|
2022-06-16 09:58:14 +00:00
|
|
|
#include <Interpreters/InterpreterCreateIndexQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/InterpreterCreateQuery.h>
|
2022-11-11 21:19:58 +00:00
|
|
|
#include <Interpreters/InterpreterCreateNamedCollectionQuery.h>
|
|
|
|
#include <Interpreters/InterpreterDropNamedCollectionQuery.h>
|
|
|
|
#include <Interpreters/InterpreterAlterNamedCollectionQuery.h>
|
2022-06-07 05:20:46 +00:00
|
|
|
#include <Interpreters/InterpreterDeleteQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterDescribeQuery.h>
|
2022-06-21 13:42:36 +00:00
|
|
|
#include <Interpreters/InterpreterDescribeCacheQuery.h>
|
2021-05-14 22:43:04 +00:00
|
|
|
#include <Interpreters/InterpreterDropFunctionQuery.h>
|
2022-06-17 07:46:44 +00:00
|
|
|
#include <Interpreters/InterpreterDropIndexQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/InterpreterDropQuery.h>
|
2023-03-21 12:14:26 +00:00
|
|
|
#include <Interpreters/InterpreterUndropQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterExistsQuery.h>
|
2020-07-01 06:42:22 +00:00
|
|
|
#include <Interpreters/InterpreterExplainQuery.h>
|
2021-04-16 20:18:39 +00:00
|
|
|
#include <Interpreters/InterpreterExternalDDLQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterFactory.h>
|
|
|
|
#include <Interpreters/InterpreterInsertQuery.h>
|
2021-08-12 11:42:51 +00:00
|
|
|
#include <Interpreters/InterpreterSelectIntersectExceptQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterKillQueryQuery.h>
|
|
|
|
#include <Interpreters/InterpreterOptimizeQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/InterpreterRenameQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterSelectQuery.h>
|
2022-07-14 11:20:16 +00:00
|
|
|
#include <Interpreters/InterpreterSelectQueryAnalyzer.h>
|
2018-02-25 06:34:20 +00:00
|
|
|
#include <Interpreters/InterpreterSelectWithUnionQuery.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/InterpreterSetQuery.h>
|
2020-07-01 06:42:22 +00:00
|
|
|
#include <Interpreters/InterpreterShowCreateQuery.h>
|
2023-01-31 15:35:10 +00:00
|
|
|
#include <Interpreters/InterpreterShowEngineQuery.h>
|
2020-05-07 02:45:27 +00:00
|
|
|
#include <Interpreters/InterpreterShowProcesslistQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterShowTablesQuery.h>
|
2023-03-26 14:36:38 +00:00
|
|
|
#include <Interpreters/InterpreterShowColumnsQuery.h>
|
2023-04-25 18:04:19 +00:00
|
|
|
#include <Interpreters/InterpreterShowIndexesQuery.h>
|
2017-08-31 12:55:19 +00:00
|
|
|
#include <Interpreters/InterpreterSystemQuery.h>
|
2017-12-20 07:39:52 +00:00
|
|
|
#include <Interpreters/InterpreterUseQuery.h>
|
2019-05-28 21:17:48 +00:00
|
|
|
#include <Interpreters/InterpreterWatchQuery.h>
|
2021-03-31 17:55:04 +00:00
|
|
|
#include <Interpreters/InterpreterTransactionControlQuery.h>
|
2020-11-09 15:07:38 +00:00
|
|
|
#include <Interpreters/OpenTelemetrySpanLog.h>
|
2015-06-18 02:11:05 +00:00
|
|
|
|
2021-10-31 08:51:20 +00:00
|
|
|
#include <Interpreters/Access/InterpreterCreateQuotaQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterCreateRoleQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterCreateRowPolicyQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterCreateSettingsProfileQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterCreateUserQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterDropAccessEntityQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterGrantQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterSetRoleQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterShowAccessEntitiesQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterShowAccessQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterShowCreateAccessEntityQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterShowGrantsQuery.h>
|
|
|
|
#include <Interpreters/Access/InterpreterShowPrivilegesQuery.h>
|
|
|
|
|
2017-08-04 15:54:00 +00:00
|
|
|
#include <Parsers/ASTSystemQuery.h>
|
2018-06-08 19:32:35 +00:00
|
|
|
|
2021-07-26 18:17:28 +00:00
|
|
|
#include <Databases/MySQL/MaterializedMySQLSyncThread.h>
|
2020-07-06 13:57:45 +00:00
|
|
|
#include <Parsers/ASTExternalDDLQuery.h>
|
|
|
|
#include <Common/ProfileEvents.h>
|
|
|
|
#include <Common/typeid_cast.h>
|
|
|
|
|
2018-06-08 19:32:35 +00:00
|
|
|
|
|
|
|
namespace ProfileEvents
|
|
|
|
{
|
|
|
|
extern const Event Query;
|
2023-05-24 15:58:42 +00:00
|
|
|
extern const Event QueriesWithSubqueries;
|
2018-06-08 19:32:35 +00:00
|
|
|
extern const Event SelectQuery;
|
|
|
|
extern const Event InsertQuery;
|
|
|
|
}
|
2017-08-04 15:54:00 +00:00
|
|
|
|
2017-07-13 20:58:19 +00:00
|
|
|
|
2015-06-18 02:11:05 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2016-01-11 21:46:36 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
extern const int UNKNOWN_TYPE_OF_QUERY;
|
2016-01-11 21:46:36 +00:00
|
|
|
}
|
|
|
|
|
2015-06-18 02:11:05 +00:00
|
|
|
|
2021-05-31 14:49:02 +00:00
|
|
|
std::unique_ptr<IInterpreter> InterpreterFactory::get(ASTPtr & query, ContextMutablePtr context, const SelectQueryOptions & options)
|
2015-06-18 02:11:05 +00:00
|
|
|
{
|
2018-06-08 19:32:35 +00:00
|
|
|
ProfileEvents::increment(ProfileEvents::Query);
|
|
|
|
|
2023-05-24 15:58:42 +00:00
|
|
|
/// SELECT and INSERT query will handle QueriesWithSubqueries on their own.
|
|
|
|
if (!(query->as<ASTSelectQuery>() ||
|
|
|
|
query->as<ASTSelectWithUnionQuery>() ||
|
|
|
|
query->as<ASTSelectIntersectExceptQuery>() ||
|
|
|
|
query->as<ASTInsertQuery>()))
|
|
|
|
{
|
|
|
|
ProfileEvents::increment(ProfileEvents::QueriesWithSubqueries);
|
|
|
|
}
|
|
|
|
|
2019-03-11 13:22:51 +00:00
|
|
|
if (query->as<ASTSelectQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2022-10-25 10:35:25 +00:00
|
|
|
if (context->getSettingsRef().allow_experimental_analyzer)
|
2022-12-23 17:45:28 +00:00
|
|
|
return std::make_unique<InterpreterSelectQueryAnalyzer>(query, context, options);
|
2022-07-14 11:20:16 +00:00
|
|
|
|
2018-06-08 19:32:35 +00:00
|
|
|
/// This is internal part of ASTSelectWithUnionQuery.
|
|
|
|
/// Even if there is SELECT without union, it is represented by ASTSelectWithUnionQuery with single ASTSelectQuery as a child.
|
2020-12-18 06:54:38 +00:00
|
|
|
return std::make_unique<InterpreterSelectQuery>(query, context, options);
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTSelectWithUnionQuery>())
|
2018-02-25 06:34:20 +00:00
|
|
|
{
|
2018-06-08 19:32:35 +00:00
|
|
|
ProfileEvents::increment(ProfileEvents::SelectQuery);
|
2022-07-14 11:20:16 +00:00
|
|
|
|
2022-10-25 10:35:25 +00:00
|
|
|
if (context->getSettingsRef().allow_experimental_analyzer)
|
2022-12-23 17:45:28 +00:00
|
|
|
return std::make_unique<InterpreterSelectQueryAnalyzer>(query, context, options);
|
2022-07-14 11:20:16 +00:00
|
|
|
|
2020-12-18 06:54:38 +00:00
|
|
|
return std::make_unique<InterpreterSelectWithUnionQuery>(query, context, options);
|
2018-02-25 06:34:20 +00:00
|
|
|
}
|
2021-08-12 11:42:51 +00:00
|
|
|
else if (query->as<ASTSelectIntersectExceptQuery>())
|
2021-04-16 20:18:39 +00:00
|
|
|
{
|
2021-08-12 11:42:51 +00:00
|
|
|
return std::make_unique<InterpreterSelectIntersectExceptQuery>(query, context, options);
|
2021-04-16 20:18:39 +00:00
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTInsertQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2018-06-08 19:32:35 +00:00
|
|
|
ProfileEvents::increment(ProfileEvents::InsertQuery);
|
2021-04-10 23:33:54 +00:00
|
|
|
bool allow_materialized = static_cast<bool>(context->getSettingsRef().insert_allow_materialized_columns);
|
2018-01-12 13:03:19 +00:00
|
|
|
return std::make_unique<InterpreterInsertQuery>(query, context, allow_materialized);
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTCreateQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTDropQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDropQuery>(query, context);
|
|
|
|
}
|
2023-03-21 12:14:26 +00:00
|
|
|
else if (query->as<ASTUndropQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterUndropQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTRenameQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterRenameQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTShowTablesQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowTablesQuery>(query, context);
|
|
|
|
}
|
2023-03-26 14:36:38 +00:00
|
|
|
else if (query->as<ASTShowColumnsQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowColumnsQuery>(query, context);
|
|
|
|
}
|
2023-04-25 18:04:19 +00:00
|
|
|
else if (query->as<ASTShowIndexesQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowIndexesQuery>(query, context);
|
|
|
|
}
|
2023-01-31 15:35:10 +00:00
|
|
|
else if (query->as<ASTShowEnginesQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowEnginesQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTUseQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterUseQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTSetQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2017-04-02 17:37:49 +00:00
|
|
|
/// readonly is checked inside InterpreterSetQuery
|
2017-04-01 07:20:54 +00:00
|
|
|
return std::make_unique<InterpreterSetQuery>(query, context);
|
|
|
|
}
|
2020-02-17 02:59:56 +00:00
|
|
|
else if (query->as<ASTSetRoleQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterSetRoleQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTOptimizeQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterOptimizeQuery>(query, context);
|
|
|
|
}
|
2020-12-24 09:16:47 +00:00
|
|
|
else if (query->as<ASTExistsDatabaseQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterExistsQuery>(query, context);
|
|
|
|
}
|
2019-10-08 12:34:04 +00:00
|
|
|
else if (query->as<ASTExistsTableQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterExistsQuery>(query, context);
|
|
|
|
}
|
2020-12-27 14:14:08 +00:00
|
|
|
else if (query->as<ASTExistsViewQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterExistsQuery>(query, context);
|
|
|
|
}
|
2019-10-11 13:21:52 +00:00
|
|
|
else if (query->as<ASTExistsDictionaryQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterExistsQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTShowCreateTableQuery>())
|
2018-03-12 14:14:56 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowCreateQuery>(query, context);
|
|
|
|
}
|
2020-12-14 14:37:25 +00:00
|
|
|
else if (query->as<ASTShowCreateViewQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowCreateQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTShowCreateDatabaseQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowCreateQuery>(query, context);
|
|
|
|
}
|
2019-10-11 13:21:52 +00:00
|
|
|
else if (query->as<ASTShowCreateDictionaryQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowCreateQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTDescribeQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDescribeQuery>(query, context);
|
|
|
|
}
|
2022-06-21 13:42:36 +00:00
|
|
|
else if (query->as<ASTDescribeCacheQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDescribeCacheQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTExplainQuery>())
|
2018-09-21 15:20:23 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterExplainQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTShowProcesslistQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowProcesslistQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTAlterQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterAlterQuery>(query, context);
|
|
|
|
}
|
2022-11-11 21:19:58 +00:00
|
|
|
else if (query->as<ASTAlterNamedCollectionQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterAlterNamedCollectionQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTCheckQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCheckQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTKillQueryQuery>())
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterKillQueryQuery>(query, context);
|
|
|
|
}
|
2019-03-11 13:22:51 +00:00
|
|
|
else if (query->as<ASTSystemQuery>())
|
2017-08-04 15:54:00 +00:00
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterSystemQuery>(query, context);
|
|
|
|
}
|
2019-05-28 21:17:48 +00:00
|
|
|
else if (query->as<ASTWatchQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterWatchQuery>(query, context);
|
|
|
|
}
|
2020-02-04 22:37:04 +00:00
|
|
|
else if (query->as<ASTCreateUserQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateUserQuery>(query, context);
|
|
|
|
}
|
2020-02-17 02:59:56 +00:00
|
|
|
else if (query->as<ASTCreateRoleQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateRoleQuery>(query, context);
|
|
|
|
}
|
2019-12-01 22:01:05 +00:00
|
|
|
else if (query->as<ASTCreateQuotaQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateQuotaQuery>(query, context);
|
|
|
|
}
|
2019-11-29 17:22:56 +00:00
|
|
|
else if (query->as<ASTCreateRowPolicyQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateRowPolicyQuery>(query, context);
|
|
|
|
}
|
2020-03-18 14:11:44 +00:00
|
|
|
else if (query->as<ASTCreateSettingsProfileQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateSettingsProfileQuery>(query, context);
|
|
|
|
}
|
2019-12-01 22:01:05 +00:00
|
|
|
else if (query->as<ASTDropAccessEntityQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDropAccessEntityQuery>(query, context);
|
|
|
|
}
|
2022-11-11 21:19:58 +00:00
|
|
|
else if (query->as<ASTDropNamedCollectionQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDropNamedCollectionQuery>(query, context);
|
|
|
|
}
|
2020-02-04 22:37:04 +00:00
|
|
|
else if (query->as<ASTGrantQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterGrantQuery>(query, context);
|
|
|
|
}
|
2019-12-01 22:01:05 +00:00
|
|
|
else if (query->as<ASTShowCreateAccessEntityQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowCreateAccessEntityQuery>(query, context);
|
|
|
|
}
|
2020-02-04 22:37:04 +00:00
|
|
|
else if (query->as<ASTShowGrantsQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowGrantsQuery>(query, context);
|
|
|
|
}
|
2020-05-07 02:45:27 +00:00
|
|
|
else if (query->as<ASTShowAccessEntitiesQuery>())
|
2019-11-29 17:22:56 +00:00
|
|
|
{
|
2020-05-07 02:45:27 +00:00
|
|
|
return std::make_unique<InterpreterShowAccessEntitiesQuery>(query, context);
|
2019-11-29 17:22:56 +00:00
|
|
|
}
|
2020-06-10 23:08:37 +00:00
|
|
|
else if (query->as<ASTShowAccessQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowAccessQuery>(query, context);
|
|
|
|
}
|
2020-05-12 21:46:14 +00:00
|
|
|
else if (query->as<ASTShowPrivilegesQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterShowPrivilegesQuery>(query, context);
|
|
|
|
}
|
2020-07-06 13:57:45 +00:00
|
|
|
else if (query->as<ASTExternalDDLQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterExternalDDLQuery>(query, context);
|
|
|
|
}
|
2021-03-31 17:55:04 +00:00
|
|
|
else if (query->as<ASTTransactionControl>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterTransactionControlQuery>(query, context);
|
|
|
|
}
|
2021-05-09 09:47:29 +00:00
|
|
|
else if (query->as<ASTCreateFunctionQuery>())
|
|
|
|
{
|
2022-09-24 21:24:39 +00:00
|
|
|
return std::make_unique<InterpreterCreateFunctionQuery>(query, context);
|
2021-05-09 09:47:29 +00:00
|
|
|
}
|
2021-05-14 22:43:04 +00:00
|
|
|
else if (query->as<ASTDropFunctionQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDropFunctionQuery>(query, context);
|
|
|
|
}
|
2022-06-16 09:58:14 +00:00
|
|
|
else if (query->as<ASTCreateIndexQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateIndexQuery>(query, context);
|
|
|
|
}
|
2022-11-11 21:19:58 +00:00
|
|
|
else if (query->as<ASTCreateNamedCollectionQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterCreateNamedCollectionQuery>(query, context);
|
|
|
|
}
|
2022-06-17 07:46:44 +00:00
|
|
|
else if (query->as<ASTDropIndexQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDropIndexQuery>(query, context);
|
|
|
|
}
|
2021-08-18 22:19:14 +00:00
|
|
|
else if (query->as<ASTBackupQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterBackupQuery>(query, context);
|
|
|
|
}
|
2022-06-07 05:20:46 +00:00
|
|
|
else if (query->as<ASTDeleteQuery>())
|
|
|
|
{
|
|
|
|
return std::make_unique<InterpreterDeleteQuery>(query, context);
|
|
|
|
}
|
2017-04-01 07:20:54 +00:00
|
|
|
else
|
2020-07-01 05:00:50 +00:00
|
|
|
{
|
2023-01-23 21:13:58 +00:00
|
|
|
throw Exception(ErrorCodes::UNKNOWN_TYPE_OF_QUERY, "Unknown type of query: {}", query->getID());
|
2020-07-01 05:00:50 +00:00
|
|
|
}
|
2015-06-18 02:11:05 +00:00
|
|
|
}
|
|
|
|
}
|