ClickHouse/src/Interpreters/DuplicateOrderByVisitor.h

42 lines
919 B
C++
Raw Normal View History

#pragma once
#include <Interpreters/InDepthNodeVisitor.h>
#include <Parsers/IAST.h>
2021-09-11 22:15:37 +00:00
namespace DB
{
class ASTSelectQuery;
/// Erases unnecessary ORDER BY from subquery
class DuplicateOrderByFromSubqueriesData
{
public:
using TypeToVisit = ASTSelectQuery;
bool done = false;
void visit(ASTSelectQuery & select_query, ASTPtr &);
};
using DuplicateOrderByFromSubqueriesMatcher = OneTypeMatcher<DuplicateOrderByFromSubqueriesData>;
using DuplicateOrderByFromSubqueriesVisitor = InDepthNodeVisitor<DuplicateOrderByFromSubqueriesMatcher, true>;
/// Finds SELECT that can be optimized
class DuplicateOrderByData
{
public:
using TypeToVisit = ASTSelectQuery;
2021-06-01 12:20:52 +00:00
ContextPtr context;
void visit(ASTSelectQuery & select_query, ASTPtr &);
};
using DuplicateOrderByMatcher = OneTypeMatcher<DuplicateOrderByData>;
using DuplicateOrderByVisitor = InDepthNodeVisitor<DuplicateOrderByMatcher, true>;
}