2022-07-14 11:20:16 +00:00
|
|
|
#include <Analyzer/IdentifierNode.h>
|
|
|
|
|
|
|
|
#include <Common/SipHash.h>
|
|
|
|
|
|
|
|
#include <IO/WriteBufferFromString.h>
|
|
|
|
#include <IO/Operators.h>
|
|
|
|
|
|
|
|
#include <Parsers/ASTIdentifier.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2022-07-19 10:54:45 +00:00
|
|
|
void IdentifierNode::dumpTreeImpl(WriteBuffer & buffer, FormatState & format_state, size_t indent) const
|
2022-07-14 11:20:16 +00:00
|
|
|
{
|
2022-07-19 10:54:45 +00:00
|
|
|
buffer << std::string(indent, ' ') << "IDENTIFIER id: " << format_state.getNodeId(this);
|
|
|
|
|
|
|
|
if (hasAlias())
|
|
|
|
buffer << ", alias: " << getAlias();
|
|
|
|
|
|
|
|
buffer << ", identifier: " << identifier.getFullName();
|
2022-07-14 11:20:16 +00:00
|
|
|
}
|
|
|
|
|
2022-07-15 13:32:53 +00:00
|
|
|
bool IdentifierNode::isEqualImpl(const IQueryTreeNode & rhs) const
|
|
|
|
{
|
|
|
|
const auto & rhs_typed = assert_cast<const IdentifierNode &>(rhs);
|
|
|
|
return identifier == rhs_typed.identifier;
|
|
|
|
}
|
|
|
|
|
2022-07-14 11:20:16 +00:00
|
|
|
void IdentifierNode::updateTreeHashImpl(HashState & state) const
|
|
|
|
{
|
|
|
|
const auto & identifier_name = identifier.getFullName();
|
|
|
|
state.update(identifier_name.size());
|
|
|
|
state.update(identifier_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
ASTPtr IdentifierNode::toASTImpl() const
|
|
|
|
{
|
|
|
|
auto identifier_parts = identifier.getParts();
|
|
|
|
return std::make_shared<ASTIdentifier>(std::move(identifier_parts));
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryTreeNodePtr IdentifierNode::cloneImpl() const
|
|
|
|
{
|
|
|
|
return std::make_shared<IdentifierNode>(identifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|