ClickHouse/src/Parsers/ASTTimeInterval.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
692 B
C++
Raw Normal View History

2023-02-12 19:17:55 +00:00
#include <Parsers/ASTTimeInterval.h>
#include <IO/Operators.h>
#include <ranges>
namespace DB
{
ASTPtr ASTTimeInterval::clone() const
{
return std::make_shared<ASTTimeInterval>(*this);
}
void ASTTimeInterval::formatImpl(const FormatSettings & f_settings, FormatState &, FormatStateStacked frame) const
{
frame.need_parens = false;
2023-11-25 03:00:32 +00:00
for (bool is_first = true; auto [kind, value] : interval.toIntervals())
2023-02-12 19:17:55 +00:00
{
if (!std::exchange(is_first, false))
f_settings.ostr << ' ';
2023-11-18 00:45:05 +00:00
f_settings.ostr << value << ' ';
f_settings.ostr << (f_settings.hilite ? hilite_keyword : "") << kind.toKeyword() << (f_settings.hilite ? hilite_none : "");
2023-02-12 19:17:55 +00:00
}
}
}