ClickHouse/dbms/src/Parsers/ASTWeightedZooKeeperPath.h

32 lines
826 B
C++
Raw Normal View History

2016-01-28 01:00:27 +00:00
#pragma once
#include <Parsers/IAST.h>
#include <Core/Types.h>
2017-04-16 05:40:17 +00:00
#include <iomanip>
2016-01-28 01:00:27 +00:00
2016-11-20 12:43:20 +00:00
2016-01-28 01:00:27 +00:00
namespace DB
{
class ASTWeightedZooKeeperPath : public IAST
{
public:
ASTWeightedZooKeeperPath() = default;
ASTWeightedZooKeeperPath(StringRange range_) : IAST(range_) {}
String getID() const override { return "Weighted_ZooKeeper_Path"; }
ASTPtr clone() const override { return std::make_shared<ASTWeightedZooKeeperPath>(*this); }
2016-01-28 01:00:27 +00:00
public:
String path;
UInt64 weight;
2016-01-28 01:00:27 +00:00
protected:
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override
{
std::string indent_str = settings.one_line ? "" : std::string(4 * frame.indent, ' ');
2017-04-16 05:40:17 +00:00
settings.ostr << settings.nl_or_ws << indent_str << std::quoted(path, '\'') << " WEIGHT " << weight;
}
2016-01-28 01:00:27 +00:00
};
}