2020-04-01 18:21:27 +00:00
|
|
|
#include <Interpreters/IdentifierSemantic.h>
|
2021-11-26 15:49:40 +00:00
|
|
|
#include <Interpreters/RenameColumnVisitor.h>
|
|
|
|
#include <Parsers/ASTIdentifier.h>
|
2020-04-01 18:21:27 +00:00
|
|
|
|
|
|
|
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
|
|
|
}
|