2020-04-01 18:21:27 +00:00
|
|
|
#include <Interpreters/RenameColumnVisitor.h>
|
|
|
|
#include <Interpreters/IdentifierSemantic.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2020-10-24 18:46:10 +00:00
|
|
|
|
2020-04-22 06:01:33 +00:00
|
|
|
void RenameColumnData::visit(ASTIdentifier & identifier, ASTPtr &) const
|
2020-04-01 18:21:27 +00:00
|
|
|
{
|
2020-10-24 18:46:10 +00:00
|
|
|
// TODO(ilezhankin): make proper rename
|
2020-04-01 18:21:27 +00:00
|
|
|
std::optional<String> identifier_column_name = IdentifierSemantic::getColumnName(identifier);
|
|
|
|
if (identifier_column_name && identifier_column_name == column_name)
|
2020-10-24 18:46:10 +00:00
|
|
|
identifier.setShortName(rename_to);
|
2020-04-01 18:21:27 +00:00
|
|
|
}
|
2020-10-24 18:46:10 +00:00
|
|
|
|
2020-04-01 18:21:27 +00:00
|
|
|
}
|