ClickHouse/dbms/include/DB/Parsers/ASTOrderByElement.h

33 lines
950 B
C++
Raw Normal View History

2011-09-04 05:14:52 +00:00
#pragma once
#include <DB/Parsers/IAST.h>
2016-11-20 12:43:20 +00:00
2011-09-04 05:14:52 +00:00
namespace DB
{
/** Элемент выражения, после которого стоит ASC или DESC
*/
class ASTOrderByElement : public IAST
{
public:
int direction; /// 1, если ASC, -1, если DESC
2016-11-20 12:43:20 +00:00
/** Collation for locale-specific string comparison. If empty, then sorting done by bytes. */
ASTPtr collation;
2014-12-17 15:26:24 +00:00
ASTOrderByElement() = default;
2016-11-20 12:43:20 +00:00
ASTOrderByElement(const StringRange range_, const int direction_, ASTPtr & collation_)
: IAST(range_), direction(direction_), collation(collation_) {}
2011-09-04 05:14:52 +00:00
/** Получить текст, который идентифицирует этот элемент. */
2014-12-17 15:26:24 +00:00
String getID() const override { return "OrderByElement"; }
2011-12-12 06:15:34 +00:00
ASTPtr clone() const override { return std::make_shared<ASTOrderByElement>(*this); }
protected:
2016-11-20 12:43:20 +00:00
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
2011-09-04 05:14:52 +00:00
};
}