mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-25 18:00:51 +00:00
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
|
#pragma once
|
|||
|
|
|||
|
#include <DB/DataTypes/IDataType.h>
|
|||
|
#include <DB/Parsers/ASTWithAlias.h>
|
|||
|
#include <DB/IO/WriteBufferFromOStream.h>
|
|||
|
|
|||
|
|
|||
|
namespace DB
|
|||
|
{
|
|||
|
|
|||
|
/** Идентификатор (столбца или алиас)
|
|||
|
*/
|
|||
|
class ASTIdentifier : public ASTWithAlias
|
|||
|
{
|
|||
|
public:
|
|||
|
enum Kind
|
|||
|
{
|
|||
|
Column,
|
|||
|
Database,
|
|||
|
Table,
|
|||
|
Format,
|
|||
|
};
|
|||
|
|
|||
|
/// имя. У составного идентификатора здесь будет конкатенированное имя (вида a.b.c), а отдельные составляюшие будут доступны внутри children.
|
|||
|
String name;
|
|||
|
|
|||
|
/// чего идентифицирует этот идентификатор
|
|||
|
Kind kind;
|
|||
|
|
|||
|
ASTIdentifier() = default;
|
|||
|
ASTIdentifier(const StringRange range_, const String & name_, const Kind kind_ = Column)
|
|||
|
: ASTWithAlias(range_), name(name_), kind(kind_) {}
|
|||
|
|
|||
|
String getColumnName() const override { return name; }
|
|||
|
|
|||
|
/** Получить текст, который идентифицирует этот элемент. */
|
|||
|
String getID() const override { return "Identifier_" + name; }
|
|||
|
|
|||
|
ASTPtr clone() const override { return new ASTIdentifier(*this); }
|
|||
|
|
|||
|
void collectIdentifierNames(IdentifierNameSet & set) const override
|
|||
|
{
|
|||
|
set.insert(name);
|
|||
|
}
|
|||
|
|
|||
|
protected:
|
|||
|
void formatImplWithoutAlias(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
|
|||
|
};
|
|||
|
|
|||
|
}
|