ClickHouse/src/Interpreters/CrossToInnerJoinVisitor.h

35 lines
837 B
C++
Raw Normal View History

2019-02-01 16:36:40 +00:00
#pragma once
#include <Interpreters/InDepthNodeVisitor.h>
#include <Interpreters/Aliases.h>
2019-02-01 16:36:40 +00:00
namespace DB
{
class ASTSelectQuery;
struct TableWithColumnNamesAndTypes;
2019-02-01 16:36:40 +00:00
/// AST transformer. It replaces cross joins with equivalented inner join if possible.
class CrossToInnerJoinMatcher
{
public:
struct Data
{
const std::vector<TableWithColumnNamesAndTypes> & tables_with_columns;
const Aliases & aliases;
const String current_database;
2019-02-01 16:36:40 +00:00
bool done = false;
bool cross_to_inner_join_rewrite = true;
2019-02-01 16:36:40 +00:00
};
static bool needChildVisit(ASTPtr &, const ASTPtr &);
2019-02-22 13:33:56 +00:00
static void visit(ASTPtr & ast, Data & data);
2019-02-01 16:36:40 +00:00
private:
static void visit(ASTSelectQuery & select, ASTPtr & ast, Data & data);
};
using CrossToInnerJoinVisitor = InDepthNodeVisitor<CrossToInnerJoinMatcher, true>;
}