mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Starting steps
This commit is contained in:
parent
6dd764bcfe
commit
489b9c80ac
@ -28,11 +28,13 @@ public:
|
||||
ADD_COLUMN,
|
||||
DROP_COLUMN,
|
||||
MODIFY_COLUMN,
|
||||
MODIFY_COLUMN_REMOVE_PROPERTY,
|
||||
COMMENT_COLUMN,
|
||||
RENAME_COLUMN,
|
||||
MODIFY_ORDER_BY,
|
||||
MODIFY_SAMPLE_BY,
|
||||
MODIFY_TTL,
|
||||
REMOVE_TABLE_TTL,
|
||||
MATERIALIZE_TTL,
|
||||
MODIFY_SETTING,
|
||||
MODIFY_QUERY,
|
||||
@ -61,6 +63,20 @@ public:
|
||||
LIVE_VIEW_REFRESH,
|
||||
};
|
||||
|
||||
/// Which property user wants to remove from column
|
||||
enum RemoveProperty
|
||||
{
|
||||
/// Default specifiers
|
||||
DEFAULT,
|
||||
MATERIALIZED,
|
||||
ALIAS,
|
||||
|
||||
/// Other properties
|
||||
COMMENT,
|
||||
CODEC,
|
||||
TTL
|
||||
};
|
||||
|
||||
Type type = NO_TYPE;
|
||||
|
||||
/** The ADD COLUMN query stores the name and type of the column to add
|
||||
@ -167,6 +183,8 @@ public:
|
||||
/// Target column name
|
||||
ASTPtr rename_to;
|
||||
|
||||
RemoveProperty to_remove;
|
||||
|
||||
String getID(char delim) const override { return "AlterCommand" + (delim + std::to_string(static_cast<int>(type))); }
|
||||
|
||||
ASTPtr clone() const override;
|
||||
|
@ -82,6 +82,8 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
|
||||
ParserKeyword s_where("WHERE");
|
||||
ParserKeyword s_to("TO");
|
||||
|
||||
ParserKeyword s_remove("REMOVE");
|
||||
|
||||
ParserCompoundIdentifier parser_name;
|
||||
ParserStringLiteral parser_string_literal;
|
||||
ParserCompoundColumnDeclaration parser_col_decl;
|
||||
@ -430,18 +432,24 @@ bool ParserAlterCommand::parseImpl(Pos & pos, ASTPtr & node, Expected & expected
|
||||
if (s_if_exists.ignore(pos, expected))
|
||||
command->if_exists = true;
|
||||
|
||||
if (!parser_modify_col_decl.parse(pos, command->col_decl, expected))
|
||||
return false;
|
||||
|
||||
if (s_first.ignore(pos, expected))
|
||||
command->first = true;
|
||||
else if (s_after.ignore(pos, expected))
|
||||
if (s_remove.ignore(pos, expected))
|
||||
{
|
||||
if (!parser_name.parse(pos, command->column, expected))
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!parser_modify_col_decl.parse(pos, command->col_decl, expected))
|
||||
return false;
|
||||
|
||||
if (s_first.ignore(pos, expected))
|
||||
command->first = true;
|
||||
else if (s_after.ignore(pos, expected))
|
||||
{
|
||||
if (!parser_name.parse(pos, command->column, expected))
|
||||
return false;
|
||||
}
|
||||
command->type = ASTAlterCommand::MODIFY_COLUMN;
|
||||
}
|
||||
|
||||
command->type = ASTAlterCommand::MODIFY_COLUMN;
|
||||
}
|
||||
else if (s_modify_order_by.ignore(pos, expected))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user