2022-06-17 07:46:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <Parsers/ASTAlterQuery.h>
|
|
|
|
#include <Parsers/ASTQueryWithOnCluster.h>
|
|
|
|
#include <Parsers/ASTQueryWithTableAndOutput.h>
|
|
|
|
#include <Parsers/IAST.h>
|
|
|
|
#include <Parsers/IParserBase.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2022-06-18 10:18:31 +00:00
|
|
|
/** DROP INDEX [IF EXISTS] name on [db].name
|
2022-06-17 07:46:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class ASTDropIndexQuery : public ASTQueryWithTableAndOutput, public ASTQueryWithOnCluster
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ASTPtr index_name;
|
|
|
|
|
2022-06-29 11:10:30 +00:00
|
|
|
bool if_exists{false};
|
|
|
|
|
2022-06-17 07:46:44 +00:00
|
|
|
String getID(char delim) const override;
|
|
|
|
|
|
|
|
ASTPtr clone() const override;
|
|
|
|
|
|
|
|
ASTPtr getRewrittenASTWithoutOnCluster(const WithoutOnClusterASTRewriteParams & params) const override
|
|
|
|
{
|
|
|
|
return removeOnCluster<ASTDropIndexQuery>(clone(), params.default_database);
|
|
|
|
}
|
|
|
|
|
2022-06-29 11:10:30 +00:00
|
|
|
QueryKind getQueryKind() const override { return QueryKind::Drop; }
|
2022-06-17 07:46:44 +00:00
|
|
|
|
2022-06-29 11:10:30 +00:00
|
|
|
/// Convert ASTDropIndexQuery to ASTAlterCommand
|
2022-06-17 07:46:44 +00:00
|
|
|
ASTPtr convertToASTAlterCommand() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|