ClickHouse/src/Interpreters/RewriteOrderByVisitor.hpp
Igor Nikonov 5a01c27eb1 Fix: clear children in order by element during rewriting
- remove unnecessary code for this PR
2022-07-05 22:48:48 +00:00

36 lines
1.1 KiB
C++

#pragma once
#include <Parsers/IAST.h>
#include <Interpreters/InDepthNodeVisitor.h>
namespace DB
{
///
/// Remove outer braces in ORDER BY
/// For example, rewrite (1) to (2)
/// (1) ... ORDER BY (a, b)
/// │ ExpressionList (children 1) │
/// │ OrderByElement (children 1) │
/// │ Function tuple (children 1) │
/// │ ExpressionList (children 2) │
/// │ Identifier CounterID │
/// │ Identifier EventDate │
/// (2) ... ORDER BY a,b
/// │ ExpressionList (children 2) │
/// │ OrderByElement (children 1) │
/// │ Identifier CounterID │
/// │ OrderByElement (children 1) │
/// │ Identifier EventDate │
///
class RewriteOrderBy
{
public:
struct Data {};
static void visit(ASTPtr & ast, Data &);
static bool needChildVisit(const ASTPtr &, const ASTPtr &) { return true; }
};
using RewriteOrderByVisitor = InDepthNodeVisitor<RewriteOrderBy, true>;
}