2020-04-01 18:21:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2021-11-26 15:49:40 +00:00
|
|
|
|
|
|
|
class ASTIdentifier;
|
|
|
|
|
2020-04-03 11:25:56 +00:00
|
|
|
/// Data for RenameColumnVisitor which traverse tree and rename all columns with
|
|
|
|
/// name column_name to rename_to
|
2020-04-01 18:21:27 +00:00
|
|
|
struct RenameColumnData
|
|
|
|
{
|
|
|
|
using TypeToVisit = ASTIdentifier;
|
|
|
|
|
|
|
|
String column_name;
|
|
|
|
String rename_to;
|
|
|
|
|
2020-04-22 06:01:33 +00:00
|
|
|
void visit(ASTIdentifier & identifier, ASTPtr & ast) const;
|
2020-04-01 18:21:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using RenameColumnMatcher = OneTypeMatcher<RenameColumnData>;
|
|
|
|
using RenameColumnVisitor = InDepthNodeVisitor<RenameColumnMatcher, true>;
|
|
|
|
}
|