1#pragma once
2
3#include <Interpreters/InDepthNodeVisitor.h>
4
5namespace DB
6{
7
8class ASTSelectQuery;
9
10/// AST transformer. It replaces cross joins with equivalented inner join if possible.
11class CrossToInnerJoinMatcher
12{
13public:
14 struct Data
15 {
16 bool done = false;
17 };
18
19 static bool needChildVisit(ASTPtr &, const ASTPtr &) { return true; }
20 static void visit(ASTPtr & ast, Data & data);
21
22private:
23 static void visit(ASTSelectQuery & select, ASTPtr & ast, Data & data);
24};
25
26using CrossToInnerJoinVisitor = InDepthNodeVisitor<CrossToInnerJoinMatcher, true>;
27
28}
29